From 615656addbb4755c0601f7685259fc7a3d74b291 Mon Sep 17 00:00:00 2001 From: Sarasa Kisaragi Date: Wed, 29 Nov 2017 19:01:40 +0800 Subject: [PATCH 1/2] Set header in function ListUserRepos Or GitHub may return something contains: 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.", --- github/apps_installation.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/github/apps_installation.go b/github/apps_installation.go index ccac316c4ec..184fa0548ca 100644 --- a/github/apps_installation.go +++ b/github/apps_installation.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"` } From 8a41fe152f6d61d16a44d6df90764515cf3daea3 Mon Sep 17 00:00:00 2001 From: Ling Samuel Date: Sat, 2 Dec 2017 18:09:54 +0800 Subject: [PATCH 2/2] Add header test for Apps.ListUserRepos --- github/apps_installation_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go index ec796cd3384..130cbbc470e 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -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",