-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept Header Issue #12
Comments
@cpheps yo. I saw you had the PR and it's closed eventually. how did you solve it at the end? using your own folk? |
@lyonlai That's was a few years and jobs. We didn't fork it but I seem to remember somehow rebuilding the headers from scratch and deleting the extra accept header. |
sigh. this should be merged. we ended up feeding a custom |
Using something like type downloadingRoundTripper struct {
roundTripper http.RoundTripper
}
func NewDownloadingRoundTripper() *downloadingRoundTripper {
return &downloadingRoundTripper{roundTripper: http.DefaultTransport}
}
func (r *downloadingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if req.Method == http.MethodGet && strings.Contains(req.URL.Path, "/releases/assets/") {
req.Header.Set("Accept", "application/octet-stream")
}
return r.roundTripper.RoundTrip(req)
} as the default roundtripper could be a workaround/ugly fix. |
I've run into an issue when using the DownloadReleaseAsset function in the
github.com/google/go-github
library. It appears the GitHub API will not correctly download a release asset binary when twoAccept
headers are present.Transport.RoundTrip adds it's own
Accept
header which causes the download to fail as the API is looking for a single header with the valueapplication/octet-stream
.Here is the link the the GitHub API documentation https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
The text was updated successfully, but these errors were encountered: