Skip to content

Remove custom media type for global node IDs #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions github/gists.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ func (s *GistsService) List(ctx context.Context, user string, opt *GistListOptio
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var gists []*Gist
resp, err := s.client.Do(ctx, req, &gists)
if err != nil {
Expand All @@ -140,9 +137,6 @@ func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gi
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var gists []*Gist
resp, err := s.client.Do(ctx, req, &gists)
if err != nil {
Expand All @@ -166,9 +160,6 @@ func (s *GistsService) ListStarred(ctx context.Context, opt *GistListOptions) ([
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var gists []*Gist
resp, err := s.client.Do(ctx, req, &gists)
if err != nil {
Expand All @@ -188,9 +179,6 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

gist := new(Gist)
resp, err := s.client.Do(ctx, req, gist)
if err != nil {
Expand All @@ -210,9 +198,6 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist,
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

gist := new(Gist)
resp, err := s.client.Do(ctx, req, gist)
if err != nil {
Expand All @@ -232,9 +217,6 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

g := new(Gist)
resp, err := s.client.Do(ctx, req, g)
if err != nil {
Expand All @@ -254,9 +236,6 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist,
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

g := new(Gist)
resp, err := s.client.Do(ctx, req, g)
if err != nil {
Expand All @@ -281,9 +260,6 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opt *ListOpti
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var gistCommits []*GistCommit
resp, err := s.client.Do(ctx, req, &gistCommits)
if err != nil {
Expand Down Expand Up @@ -353,9 +329,6 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

g := new(Gist)
resp, err := s.client.Do(ctx, req, g)
if err != nil {
Expand All @@ -375,9 +348,6 @@ func (s *GistsService) ListForks(ctx context.Context, id string) ([]*GistFork, *
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var gistForks []*GistFork
resp, err := s.client.Do(ctx, req, &gistForks)
if err != nil {
Expand Down
12 changes: 0 additions & 12 deletions github/gists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestGistsService_List_specifiedUser(t *testing.T) {

mux.HandleFunc("/users/u/gists", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, values{
"since": since,
})
Expand All @@ -48,7 +47,6 @@ func TestGistsService_List_authenticatedUser(t *testing.T) {

mux.HandleFunc("/gists", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
fmt.Fprint(w, `[{"id": "1"}]`)
})

Expand Down Expand Up @@ -79,7 +77,6 @@ func TestGistsService_ListAll(t *testing.T) {

mux.HandleFunc("/gists/public", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, values{
"since": since,
})
Expand All @@ -106,7 +103,6 @@ func TestGistsService_ListStarred(t *testing.T) {

mux.HandleFunc("/gists/starred", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, values{
"since": since,
})
Expand All @@ -131,7 +127,6 @@ func TestGistsService_Get(t *testing.T) {

mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
fmt.Fprint(w, `{"id": "1"}`)
})

Expand Down Expand Up @@ -160,7 +155,6 @@ func TestGistsService_GetRevision(t *testing.T) {

mux.HandleFunc("/gists/1/s", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
fmt.Fprint(w, `{"id": "1"}`)
})

Expand Down Expand Up @@ -200,7 +194,6 @@ func TestGistsService_Create(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)

testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
if !reflect.DeepEqual(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
Expand Down Expand Up @@ -253,7 +246,6 @@ func TestGistsService_Edit(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)

testMethod(t, r, "PATCH")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
if !reflect.DeepEqual(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
Expand Down Expand Up @@ -308,7 +300,6 @@ func TestGistsService_ListCommits(t *testing.T) {

mux.HandleFunc("/gists/1/commits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, nil)
fmt.Fprint(w, `
[
Expand Down Expand Up @@ -356,7 +347,6 @@ func TestGistsService_ListCommits_withOptions(t *testing.T) {

mux.HandleFunc("/gists/1/commits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, values{
"page": "2",
})
Expand Down Expand Up @@ -485,7 +475,6 @@ func TestGistsService_Fork(t *testing.T) {

mux.HandleFunc("/gists/1/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
fmt.Fprint(w, `{"id": "2"}`)
})

Expand All @@ -506,7 +495,6 @@ func TestGistsService_ListForks(t *testing.T) {

mux.HandleFunc("/gists/1/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)
testFormValues(t, r, nil)
fmt.Fprint(w, `
[
Expand Down
6 changes: 0 additions & 6 deletions github/git_blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

blob := new(Blob)
resp, err := s.client.Do(ctx, req, blob)
return blob, resp, err
Expand Down Expand Up @@ -66,9 +63,6 @@ func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string,
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

t := new(Blob)
resp, err := s.client.Do(ctx, req, t)
return t, resp, err
Expand Down
2 changes: 0 additions & 2 deletions github/git_blobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestGitService_GetBlob(t *testing.T) {

mux.HandleFunc("/repos/o/r/git/blobs/s", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)

fmt.Fprint(w, `{
"sha": "s",
Expand Down Expand Up @@ -90,7 +89,6 @@ func TestGitService_CreateBlob(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)

testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)

want := input
if !reflect.DeepEqual(v, want) {
Expand Down
7 changes: 1 addition & 6 deletions github/git_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package github
import (
"context"
"fmt"
"strings"
"time"
)

Expand Down Expand Up @@ -70,8 +69,7 @@ func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, s
}

// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
req.Header.Set("Accept", mediaTypeGitSigningPreview)

c := new(Commit)
resp, err := s.client.Do(ctx, req, c)
Expand Down Expand Up @@ -126,9 +124,6 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

c := new(Commit)
resp, err := s.client.Do(ctx, req, c)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions github/git_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ import (
"fmt"
"net/http"
"reflect"
"strings"
"testing"
)

func TestGitService_GetCommit(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

acceptHeaders := []string{mediaTypeGitSigningPreview, mediaTypeGraphQLNodeIDPreview}
mux.HandleFunc("/repos/o/r/git/commits/s", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
testHeader(t, r, "Accept", mediaTypeGitSigningPreview)
fmt.Fprint(w, `{"sha":"s","message":"m","author":{"name":"n"}}`)
})

Expand Down Expand Up @@ -60,7 +58,6 @@ func TestGitService_CreateCommit(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)

testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeGraphQLNodeIDPreview)

want := &createCommit{
Message: input.Message,
Expand Down
15 changes: 0 additions & 15 deletions github/git_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

r := new(Reference)
resp, err := s.client.Do(ctx, req, r)
if _, ok := err.(*json.UnmarshalTypeError); ok {
Expand Down Expand Up @@ -97,9 +94,6 @@ func (s *GitService) GetRefs(ctx context.Context, owner string, repo string, ref
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var rawJSON json.RawMessage
resp, err := s.client.Do(ctx, req, &rawJSON)
if err != nil {
Expand Down Expand Up @@ -154,9 +148,6 @@ func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *Refe
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

var rs []*Reference
resp, err := s.client.Do(ctx, req, &rs)
if err != nil {
Expand All @@ -180,9 +171,6 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

r := new(Reference)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand All @@ -206,9 +194,6 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r
return nil, nil, err
}

// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)

r := new(Reference)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand Down
Loading