Skip to content

Support for multiple headers in Cask url stanza #15590

Description

@donaldducky

Verification

Provide a detailed description of the proposed feature

The ability to pass multiple headers similar to how a formula can pass them.

Example here:

  url "https://api.github.com/repos/Homebrew/homebrew-portable-ruby/releases/assets/103219629",
      headers: [
        "Accept: application/octet-stream",
        "Authorization: bearer #{ENV["HOMEBREW_GITHUB_API_TOKEN"]}"
      ]

One way I was able to see this work, locally, was by updating Library/Homebrew/cask/url.rb to have a headers param next to header that is a T.nilable(T::Array[String]).

What is the motivation for the feature?

I need to pass a couple of headers to trigger a download using the GitHub API and it requires two headers:

  • Accept: application/octet-stream
  • Authorization: Bearer <token>

The existing url stanza seems to support passing a single header.

How will the feature be relevant to at least 90% of Homebrew users?

It would allow for passing more than one header in a cask, if the need arises.

The API would also be closer to that of a formula that allows passing headers.

What alternatives to the feature have been considered?

Host assets elsewhere

This is an alternative that would require no code changes.

I would prefer not to take that route as it would introduce more infrastructure -- we already use GitHub and GH Actions, so all of this is already hooked up.

Support for Custom Download Strategy

Formulae support custom download strategies.

This would be the most extensible way, opening doors for various other methods of downloading files, but may be quite a bit more involved.

Any other ways?

I'm open to trying other approaches, please let me know if there's something I may have missed! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions