diff --git a/github/repos.go b/github/repos.go index ed9052c..2e9b29e 100644 --- a/github/repos.go +++ b/github/repos.go @@ -146,6 +146,9 @@ func (s *RepositoriesService) List(user string, opt *RepositoryListOptions) ([]R return nil, nil, err } + // TODO: remove custom Accept header when license support fully launches + req.Header.Set("Accept", mediaTypeLicensesPreview) + repos := new([]Repository) resp, err := s.client.Do(req, repos) if err != nil { @@ -180,6 +183,9 @@ func (s *RepositoriesService) ListByOrg(org string, opt *RepositoryListByOrgOpti return nil, nil, err } + // TODO: remove custom Accept header when license support fully launches + req.Header.Set("Accept", mediaTypeLicensesPreview) + repos := new([]Repository) resp, err := s.client.Do(req, repos) if err != nil { diff --git a/github/repos_test.go b/github/repos_test.go index 3a2c413..6e98e28 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -19,6 +19,7 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) { mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeLicensesPreview) fmt.Fprint(w, `[{"id":1},{"id":2}]`) }) @@ -39,6 +40,7 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) { mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeLicensesPreview) testFormValues(t, r, values{ "type": "owner", "sort": "created", @@ -71,6 +73,7 @@ func TestRepositoriesService_ListByOrg(t *testing.T) { mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeLicensesPreview) testFormValues(t, r, values{ "type": "forks", "page": "2",