Skip to content
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

Incorrect Accept header in DownloadReleaseAsset. #870

Closed
SteelPhase opened this issue Mar 14, 2018 · 2 comments · Fixed by #874
Closed

Incorrect Accept header in DownloadReleaseAsset. #870

SteelPhase opened this issue Mar 14, 2018 · 2 comments · Fixed by #874

Comments

@SteelPhase
Copy link
Contributor

acceptHeaders := []string{defaultMediaType, mediaTypeGraphQLNodeIDPreview}

I was able to confirm with curl, that removing mediaTypeGraphQLNodeIDPreview from the Accept header will result in the server returning the correct response.

With the mediaTypeGraphQLNodeIDPreview Accept header the v3 json response is returned.

@dmitshur
Copy link
Member

dmitshur commented Mar 19, 2018

Thanks for reporting. I suspect this is a bug that affects all GitHub versions. mediaTypeGraphQLNodeIDPreview should not have been added to that endpoint, because it operates on binary data, not JSON.

mediaTypeGraphQLNodeIDPreview should be set for GetReleaseAsset method.
It should not be set for DownloadReleaseAsset method.

We should remove mediaTypeGraphQLNodeIDPreview from DownloadReleaseAsset.

@rhysd
Copy link
Contributor

rhysd commented Mar 21, 2018

I'm also facing this problem even if I use GitHub API (not enterprise). After the mediaTypeGraphQLNodeIDPreview is added, a binary file downloaded with the method is broken. I confirmed that removing mediaTypeGraphQLNodeIDPreview from the custom accept headers fixed the problem.

rhysd added a commit to rhysd/go-github that referenced this issue Mar 21, 2018
rhysd added a commit to rhysd/go-github that referenced this issue Mar 21, 2018
rhysd added a commit to rhysd/go-github-selfupdate that referenced this issue Mar 21, 2018
rhysd added a commit to rhysd/go-github that referenced this issue Mar 22, 2018
@dmitshur dmitshur changed the title Accept Header for DownloadReleaseAsset causing issues with Github Enterprise v2.12 v3 api Incorrect Accept header in DownloadReleaseAsset. Mar 23, 2018
nbareil pushed a commit to nbareil/go-github that referenced this issue May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants