Merge pull request #15602 from donaldducky/cask-support-multiple-headers

Cask support multiple headers
This commit is contained in:
Bo Anderson 2023-07-20 21:19:55 +01:00 committed by GitHub
commit 67ecc2452a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

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

View File

@ -1079,7 +1079,7 @@ When a plain URL string is insufficient to fetch a file, additional information
| `using:` | the symbol `:post` is the only legal value | `using:` | the symbol `:post` is the only legal value
| `cookies:` | hash of cookies to be set in the download request | `cookies:` | hash of cookies to be set in the download request
| `referer:` | string holding the URL to set as referer in the download request | `referer:` | string holding the URL to set as referer in the download request
| `header:` | string holding the header to set for the download request | `header:` | string or array of strings holding the header(s) to set for the download request
| `user_agent:` | string holding the user agent to set for the download request. Can also be set to the symbol `:fake`, which will use a generic browser-like user agent string. We prefer `:fake` when the server does not require a specific user agent. | `user_agent:` | string holding the user agent to set for the download request. Can also be set to the symbol `:fake`, which will use a generic browser-like user agent string. We prefer `:fake` when the server does not require a specific user agent.
| `data:` | hash of parameters to be set in the POST request | `data:` | hash of parameters to be set in the POST request
@ -1087,7 +1087,7 @@ Example of using `cookies:`: [oracle-jdk-javadoc.rb](https://github.com/Homebrew
Example of using `referer:`: [firealpaca.rb](https://github.com/Homebrew/homebrew-cask/blob/37f434b99f51259e642793d65b7490540b71dc21/Casks/firealpaca.rb#L5-L6) Example of using `referer:`: [firealpaca.rb](https://github.com/Homebrew/homebrew-cask/blob/37f434b99f51259e642793d65b7490540b71dc21/Casks/firealpaca.rb#L5-L6)
Example of using `header:`: [issue-325182724](https://github.com/Homebrew/brew/pull/6545#issue-325182724) Example of using `header:`: [issue-325182724](https://github.com/Homebrew/brew/pull/6545#issue-325182724) [issue-15590](https://github.com/Homebrew/brew/issues/15590)
#### When URL and Homepage Domains Differ, Add `verified:` #### When URL and Homepage Domains Differ, Add `verified:`