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

Apps.ListUserRepos may return message "specify a custom media type in the 'Accept' header". #797

Closed
lingsamuel opened this Issue Nov 29, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@lingsamuel
Contributor

lingsamuel commented Nov 29, 2017

When I am trying to use Apps.ListUserRepos, I got message like this:
image

I know this can be fix by adding following accept header:

// in github/github.go line 85~86
// https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"

And it can be fix by add following to ListUserRepos function in github/apps_installation.go

req.Header.Set("Accept", mediaTypeIntegrationPreview)

I can provide a PR to fix this.

I noticed that there is a TODO comment in other function says that TODO: remove custom Accept header when this API fully launches., so I will keep this in my fix.

@dmitshur

This comment has been minimized.

Show comment
Hide comment
@dmitshur

dmitshur Dec 1, 2017

Member

Hi, thanks for reporting this.

I've taken a look at the documentation for that endpoint at https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation and was surprised to find that it doesn't mention anything about a custom Accept header there.

I'd really like to be able to confirm that adding that header is the right fix via documentation.

After digging further, I found PR #436 which mentioned https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/, which includes:

image

So I think that confirms this is the right thing to do.

Member

dmitshur commented Dec 1, 2017

Hi, thanks for reporting this.

I've taken a look at the documentation for that endpoint at https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation and was surprised to find that it doesn't mention anything about a custom Accept header there.

I'd really like to be able to confirm that adding that header is the right fix via documentation.

After digging further, I found PR #436 which mentioned https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/, which includes:

image

So I think that confirms this is the right thing to do.

@dmitshur dmitshur added the bug label Dec 1, 2017

@dmitshur dmitshur closed this in #798 Dec 2, 2017

dmitshur added a commit that referenced this issue Dec 2, 2017

Set Accept header in AppsService.ListUserRepos. (#798)
Without this custom media type in the Accept header, GitHub API responds
with:

	{
	  "message": "If you would like to help us test the Integrations API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.",
	  "documentation_url": "https://developer.github.com/v3"
	}

The custom media type requirement is documented at
https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/.

Fixes #797.

nbareil pushed a commit to nbareil/go-github that referenced this issue May 1, 2018

Set Accept header in AppsService.ListUserRepos. (google#798)
Without this custom media type in the Accept header, GitHub API responds
with:

	{
	  "message": "If you would like to help us test the Integrations API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.",
	  "documentation_url": "https://developer.github.com/v3"
	}

The custom media type requirement is documented at
https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/.

Fixes google#797.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment