SIGN IN SIGN UP
Homebrew / brew UNCLAIMED

🍺 The missing package manager for macOS (or Linux)

0 0 185 Ruby

HeaderMatch: pass all headers into strategy block

This modifies livecheck's `HeaderMatch` strategy to allow `strategy`
blocks to use an `all_headers` argument to receive the original array
of response headers rather than a merged hash that only includes the
last instance of a given header. Over the years, we've encountered a
few checks where a server makes multiple redirections (i.e., there are
multiple responses with a `Location` header) but we need to target a
`Location` header that isn't the last occurrence. This hasn't been
possible due to the `merged_headers` setup, so we've simply worked
around it.

We recently ran into this shortcoming again in homebrew-cask but there
isn't a way to work around it this time, so this is now strictly
necessary. This implementation borrows from my prior art in the
`Sparkle` strategy, where the name of the first argument to a
`strategy` block is strictly enforced and the name dictates what value
is provided. I've ensured that all `HeaderMatch` strategy blocks in
core/cask use a `headers` argument, so they will continue working as
expected.
S
Sam Ford committed
c268b777c2e7dfa95aadef39b46557dc37da9229
Parent: bff565a