curl_headers: Handle POST requests #19445
Open
+27
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Livecheck::Strategy.page_headers
usesUtils::Curl.curl_headers
but the method only handlesHEAD
andGET
requests. I recently addedPOST
support to livecheck but forgot to updatecurl_headers
in the process, solivecheck
blocks using theHeaderMatch
strategy along withpost_form
orpost_json
will fail because curl doesn't allow both--head
and--data
/--json
arguments (e.g., Homebrew/homebrew-cask#204216).This addresses the issue by updating
curl_headers
to handlePOST
requests and skip theGET
retry logic.The aforementioned
effect-house
PR also demonstrated that some servers will return an unexpected response if aContent-Length
header isn't included in thePOST
request, so this adds the header to thepost_args
array whenpost_form
orpost_json
are used.