-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).PR will require a bump to the major version num in next release. Look here to see the change(s).enhancementgood first issue
Description
It's common for master branch to be renamed to main branch.
I noticed that when trying to get a renamed master branch, I normally get a 301:
$ curl -i -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/asraa/asraa.github.io/branches/master
HTTP/2 301
server: GitHub.com
date: Tue, 15 Jun 2021 15:31:51 GMT
content-type: application/json; charset=utf-8
content-length: 190
x-oauth-scopes: public_repo, read:org
x-accepted-oauth-scopes:
location: https://api.github.com/repositories/asraa/asraa.github.io/branches/main
x-github-media-type: github.v3; format=json
x-ratelimit-limit: 5000
x-ratelimit-remaining: 4628
x-ratelimit-reset: 1623773879
x-ratelimit-used: 372
x-ratelimit-resource: core
access-control-expose-headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset
access-control-allow-origin: *
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'
vary: Accept-Encoding, Accept, X-Requested-With
x-github-request-id: AEFA:589F:209F980:435C7FE:60C8C7E7
{
"message": "Moved Permanently",
"url": "https://api.github.com/repositories/asraa/asraa.github.io/branches/main",
"documentation_url": "https://docs.github.com/v3/#http-redirects"
}
But using go-github, I get a 404 response. Is there any way to handle the 301 response and include the redirect URL in the response body when calling GetBranch
?
Metadata
Metadata
Assignees
Labels
Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).PR will require a bump to the major version num in next release. Look here to see the change(s).enhancementgood first issue