Always pass headers as array to downloader, if present

We still need to support it being named "header" in the Cask url stanza.
This commit is contained in:
Don Chea 2023-06-28 09:11:14 -04:00
parent 0e9a8418fc
commit 907a9238c2
2 changed files with 4 additions and 7 deletions

View File

@ -57,6 +57,8 @@ module Cask
@uri = URI(uri)
header = Array(header) unless header.nil?
specs = {}
specs[:verified] = @verified = verified
specs[:using] = @using = using
@ -67,7 +69,7 @@ module Cask
specs[:trust_cert] = @trust_cert = trust_cert
specs[:cookies] = @cookies = cookies
specs[:referer] = @referer = referer
specs[:header] = @header = header
specs[:headers] = @header = header
specs[:user_agent] = @user_agent = user_agent || :default
specs[:data] = @data = data
specs[:only_path] = @only_path = only_path

View File

@ -389,13 +389,8 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
# Merge `:header` with `:headers`.
if (header = meta.delete(:header))
meta[:headers] ||= []
if header.is_a?(Array)
meta[:headers] += header
else
meta[:headers] << header
end
end
super
end