diff --git a/github/repos.go b/github/repos.go index 365520b..cba160c 100644 --- a/github/repos.go +++ b/github/repos.go @@ -486,6 +486,8 @@ func (s *RepositoriesService) ListBranches(owner string, repo string, opt *ListO return nil, nil, err } + req.Header.Set("Accept", mediaTypeProtectedBranchesPreview) + branches := new([]Branch) resp, err := s.client.Do(req, branches) if err != nil { diff --git a/github/repos_test.go b/github/repos_test.go index c4dcb0d..daecf0a 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -367,6 +367,7 @@ func TestRepositoriesService_ListBranches(t *testing.T) { mux.HandleFunc("/repos/o/r/branches", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeProtectedBranchesPreview) testFormValues(t, r, values{"page": "2"}) fmt.Fprint(w, `[{"name":"master", "commit" : {"sha" : "a57781", "url" : "https://api.github.com/repos/o/r/commits/a57781"}}]`) })