Browse Source

add preview header to list branches request

Luke Roberts 10 years ago
committed by Will Norris
parent
commit
4c742510b0
2 changed files with 3 additions and 0 deletions
  1. +2
    -0
      github/repos.go
  2. +1
    -0
      github/repos_test.go

+ 2
- 0
github/repos.go View File

@ -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 {


+ 1
- 0
github/repos_test.go View File

@ -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"}}]`)
})


Loading…
Cancel
Save