Merge pull request #13601 from bayandin/cleaup-github-headers
Clean up GitHub headers
This commit is contained in:
commit
1af0bcde20
@ -603,13 +603,13 @@ EOS
|
||||
# Only try to `git fetch` when the upstream tags have changed
|
||||
# (so the API does not return 304: unmodified).
|
||||
GITHUB_API_ETAG="$(sed -n 's/^ETag: "\([a-f0-9]\{32\}\)".*/\1/p' ".git/GITHUB_HEADERS" 2>/dev/null)"
|
||||
GITHUB_API_ACCEPT="application/vnd.github.v3+json"
|
||||
GITHUB_API_ACCEPT="application/vnd.github+json"
|
||||
GITHUB_API_ENDPOINT="tags"
|
||||
else
|
||||
# Only try to `git fetch` when the upstream branch is at a different SHA
|
||||
# (so the API does not return 304: unmodified).
|
||||
GITHUB_API_ETAG="$(git rev-parse "refs/remotes/origin/${UPSTREAM_BRANCH_DIR}")"
|
||||
GITHUB_API_ACCEPT="application/vnd.github.v3.sha"
|
||||
GITHUB_API_ACCEPT="application/vnd.github.sha"
|
||||
GITHUB_API_ENDPOINT="commits/${UPSTREAM_BRANCH_DIR}"
|
||||
fi
|
||||
|
||||
|
||||
@ -1034,7 +1034,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
||||
|
||||
output, _, status = curl_output(
|
||||
"--silent", "--head", "--location",
|
||||
"-H", "Accept: application/vnd.github.v3.sha",
|
||||
"-H", "Accept: application/vnd.github.sha",
|
||||
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{@ref}"
|
||||
)
|
||||
|
||||
@ -1051,7 +1051,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
||||
|
||||
output, _, status = curl_output(
|
||||
"--silent", "--head", "--location",
|
||||
"-H", "Accept: application/vnd.github.v3.sha",
|
||||
"-H", "Accept: application/vnd.github.sha",
|
||||
"https://api.github.com/repos/#{@user}/#{@repo}/commits/#{commit}"
|
||||
)
|
||||
|
||||
|
||||
@ -184,8 +184,7 @@ module GitHub
|
||||
# This is a no-op if the user is opting out of using the GitHub API.
|
||||
return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
|
||||
|
||||
args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%\{http_code}"]
|
||||
args += ["--header", "Accept: application/vnd.github.antiope-preview+json"]
|
||||
args = ["--header", "Accept: application/vnd.github+json", "--write-out", "\n%\{http_code}"]
|
||||
|
||||
token = credentials
|
||||
args += ["--header", "Authorization: token #{token}"] unless credentials_type == :none
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user