Browse files

Set Accept header in AppsService.ListUserRepos. (#798)

Without this custom media type in the Accept header, GitHub API responds

	  "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": ""

The custom media type requirement is documented at

Fixes #797.
  • Loading branch information...
lingsamuel authored and dmitshur committed Dec 2, 2017
1 parent d4f26c3 commit b527232f71688a60af52f516ee87de79d0c7167b
Showing with 4 additions and 0 deletions.
  1. +3 −0 github/apps_installation.go
  2. +1 −0 github/apps_installation_test.go
@@ -67,6 +67,9 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int, opt *ListOption
return nil, nil, err
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeIntegrationPreview)
var r struct {
Repositories []*Repository `json:"repositories"`
@@ -45,6 +45,7 @@ func TestAppsService_ListUserRepos(t *testing.T) {
mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",

0 comments on commit b527232

Please sign in to comment.