Skip to content

#638: Remove custom media type for Pull Request Reviews API #641

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
May 15, 2017
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
3 changes: 0 additions & 3 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ const (
// https://developer.github.com/changes/2017-01-05-commit-search-api/
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"

// https://developer.github.com/changes/2016-12-14-reviews-api/
mediaTypePullRequestReviewsPreview = "application/vnd.github.black-cat-preview+json"

// https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
)
Expand Down
9 changes: 0 additions & 9 deletions github/pulls_reviewers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo
return nil, nil, err
}

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

r := new(PullRequest)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand All @@ -53,9 +50,6 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str
return nil, nil, err
}

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

var users []*User
resp, err := s.client.Do(ctx, req, &users)
if err != nil {
Expand All @@ -81,8 +75,5 @@ func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo s
return nil, err
}

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

return s.client.Do(ctx, req, reviewers)
}
4 changes: 0 additions & 4 deletions github/pulls_reviewers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func TestRequestReviewers(t *testing.T) {

mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
testBody(t, r, `{"reviewers":["octocat","googlebot"]}`+"\n")
fmt.Fprint(w, `{"number":1}`)
})
Expand All @@ -41,7 +40,6 @@ func TestRemoveReviewers(t *testing.T) {

mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
testBody(t, r, `{"reviewers":["octocat","googlebot"]}`+"\n")
})

Expand All @@ -57,7 +55,6 @@ func TestListReviewers(t *testing.T) {

mux.HandleFunc("/repos/o/r/pulls/1/requested_reviewers", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `[{"login":"octocat","id":1}]`)
})

Expand Down Expand Up @@ -86,7 +83,6 @@ func TestListReviewers_withOptions(t *testing.T) {
testFormValues(t, r, values{
"page": "2",
})
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `[]`)
})

Expand Down
21 changes: 0 additions & 21 deletions github/pulls_reviews.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin
return nil, nil, err
}

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

var reviews []*PullRequestReview
resp, err := s.client.Do(ctx, req, &reviews)
if err != nil {
Expand All @@ -104,9 +101,6 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string,
return nil, nil, err
}

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

review := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, review)
if err != nil {
Expand All @@ -131,9 +125,6 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re
return nil, nil, err
}

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

review := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, review)
if err != nil {
Expand Down Expand Up @@ -162,9 +153,6 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep
return nil, nil, err
}

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

var comments []*PullRequestComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
Expand All @@ -189,9 +177,6 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri
return nil, nil, err
}

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

r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand All @@ -216,9 +201,6 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri
return nil, nil, err
}

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

r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand All @@ -243,9 +225,6 @@ func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo str
return nil, nil, err
}

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

r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
Expand Down
8 changes: 0 additions & 8 deletions github/pulls_reviews_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestPullRequestsService_ListReviews(t *testing.T) {
testFormValues(t, r, values{
"page": "2",
})
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})

Expand Down Expand Up @@ -53,7 +52,6 @@ func TestPullRequestsService_GetReview(t *testing.T) {

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

Expand All @@ -79,7 +77,6 @@ func TestPullRequestsService_DeletePendingReview(t *testing.T) {

mux.HandleFunc("/repos/o/r/pulls/1/reviews/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `{"id":1}`)
})

Expand All @@ -105,7 +102,6 @@ func TestPullRequestsService_ListReviewComments(t *testing.T) {

mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})

Expand All @@ -132,7 +128,6 @@ func TestPullRequestsService_ListReviewComments_withOptions(t *testing.T) {
testFormValues(t, r, values{
"page": "2",
})
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
fmt.Fprint(w, `[]`)
})

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

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

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

testMethod(t, r, "PUT")
testHeader(t, r, "Accept", mediaTypePullRequestReviewsPreview)
if !reflect.DeepEqual(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
Expand Down