Rename curl_head to curl_headers.

This commit is contained in:
Markus Reiter 2023-05-06 03:41:35 +02:00
parent 545a332fef
commit 353818f508
No known key found for this signature in database
GPG Key ID: 245293B51702655B
4 changed files with 4 additions and 4 deletions

View File

@ -473,7 +473,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/") url = url.sub(%r{^https?://#{GitHubPackages::URL_DOMAIN}/}o, "#{domain.chomp("/")}/")
end end
parsed_output = curl_head(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout) parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout)
parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) } parsed_headers = parsed_output.fetch(:responses).map { |r| r.fetch(:headers) }
final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url) final_url = curl_response_follow_redirections(parsed_output.fetch(:responses), url)

View File

@ -182,7 +182,7 @@ module Homebrew
headers = [] headers = []
[:default, :browser].each do |user_agent| [:default, :browser].each do |user_agent|
output, _, status = curl_head( output, _, status = curl_headers(
url, url,
wanted_headers: ["location", "content-disposition"], wanted_headers: ["location", "content-disposition"],
use_homebrew_curl: homebrew_curl, use_homebrew_curl: homebrew_curl,

View File

@ -12,7 +12,7 @@ describe CurlDownloadStrategy do
let(:artifact_domain) { nil } let(:artifact_domain) { nil }
before do before do
allow(strategy).to receive(:curl_head).and_return({ responses: [{ headers: {} }] }) allow(strategy).to receive(:curl_headers).and_return({ responses: [{ headers: {} }] })
end end
it "parses the opts and sets the corresponding args" do it "parses the opts and sets the corresponding args" do

View File

@ -205,7 +205,7 @@ module Utils
curl_with_workarounds(*args, print_stderr: false, show_output: true, **options) curl_with_workarounds(*args, print_stderr: false, show_output: true, **options)
end end
def curl_head(*args, wanted_headers: [], **options) def curl_headers(*args, wanted_headers: [], **options)
[[], ["--request", "GET"]].each do |request_args| [[], ["--request", "GET"]].each do |request_args|
result = curl_output( result = curl_output(
"--fail", "--location", "--silent", "--head", *request_args, *args, "--fail", "--location", "--silent", "--head", *request_args, *args,