Skip to content
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
18 changes: 0 additions & 18 deletions github/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response,
return nil, nil, err
}

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

app := new(App)
resp, err := s.client.Do(ctx, req, app)
if err != nil {
Expand All @@ -171,9 +168,6 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions)
return nil, nil, err
}

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

var i []*Installation
resp, err := s.client.Do(ctx, req, &i)
if err != nil {
Expand Down Expand Up @@ -204,9 +198,6 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio
return nil, nil, err
}

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

var i struct {
Installations []*Installation `json:"installations"`
}
Expand Down Expand Up @@ -257,9 +248,6 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon
return nil, err
}

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

return s.client.Do(ctx, req, nil)
}

Expand All @@ -274,9 +262,6 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt
return nil, nil, err
}

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

t := new(InstallationToken)
resp, err := s.client.Do(ctx, req, t)
if err != nil {
Expand Down Expand Up @@ -343,9 +328,6 @@ func (s *AppsService) getInstallation(ctx context.Context, url string) (*Install
return nil, nil, err
}

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

i := new(Installation)
resp, err := s.client.Do(ctx, req, i)
if err != nil {
Expand Down
8 changes: 0 additions & 8 deletions github/apps_installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) ([]*Repo
return nil, nil, err
}

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

var r struct {
Repositories []*Repository `json:"repositories"`
}
Expand Down Expand Up @@ -54,9 +51,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
return nil, nil, err
}

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

var r struct {
Repositories []*Repository `json:"repositories"`
}
Expand All @@ -77,7 +71,6 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (
if err != nil {
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeIntegrationPreview)

r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
Expand All @@ -97,7 +90,6 @@ func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64
if err != nil {
return nil, err
}
req.Header.Set("Accept", mediaTypeIntegrationPreview)

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

mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
Expand All @@ -45,7 +44,6 @@ func TestAppsService_ListUserRepos(t *testing.T) {

mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
Expand All @@ -71,7 +69,6 @@ func TestAppsService_AddRepository(t *testing.T) {

mux.HandleFunc("/user/installations/1/repositories/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"}}`)
})

Expand All @@ -92,7 +89,6 @@ func TestAppsService_RemoveRepository(t *testing.T) {

mux.HandleFunc("/user/installations/1/repositories/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
w.WriteHeader(http.StatusNoContent)
})

Expand Down
12 changes: 0 additions & 12 deletions github/apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func TestAppsService_Get_authenticatedApp(t *testing.T) {

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

Expand All @@ -45,7 +44,6 @@ func TestAppsService_Get_specifiedApp(t *testing.T) {

mux.HandleFunc("/apps/a", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"html_url":"https://github.com/apps/a"}`)
})

Expand All @@ -66,7 +64,6 @@ func TestAppsService_ListInstallations(t *testing.T) {

mux.HandleFunc("/app/installations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
Expand Down Expand Up @@ -167,7 +164,6 @@ func TestAppsService_GetInstallation(t *testing.T) {

mux.HandleFunc("/app/installations/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1, "app_id":1, "target_id":1, "target_type": "Organization"}`)
})

Expand All @@ -188,7 +184,6 @@ func TestAppsService_ListUserInstallations(t *testing.T) {

mux.HandleFunc("/user/installations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
Expand Down Expand Up @@ -245,7 +240,6 @@ func TestAppsService_DeleteInstallation(t *testing.T) {
mux.HandleFunc("/app/installations/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
w.WriteHeader(http.StatusNoContent)
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
})

_, err := client.Apps.DeleteInstallation(context.Background(), 1)
Expand All @@ -260,7 +254,6 @@ func TestAppsService_CreateInstallationToken(t *testing.T) {

mux.HandleFunc("/app/installations/1/access_tokens", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"token":"t"}`)
})

Expand Down Expand Up @@ -307,7 +300,6 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) {
}

testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"token":"t"}`)
})

Expand Down Expand Up @@ -351,7 +343,6 @@ func TestAppsService_FindOrganizationInstallation(t *testing.T) {

mux.HandleFunc("/orgs/o/installation", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1, "app_id":1, "target_id":1, "target_type": "Organization"}`)
})

Expand All @@ -372,7 +363,6 @@ func TestAppsService_FindRepositoryInstallation(t *testing.T) {

mux.HandleFunc("/repos/o/r/installation", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1, "app_id":1, "target_id":1, "target_type": "Organization"}`)
})

Expand All @@ -393,7 +383,6 @@ func TestAppsService_FindRepositoryInstallationByID(t *testing.T) {

mux.HandleFunc("/repositories/1/installation", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1, "app_id":1, "target_id":1, "target_type": "Organization"}`)
})

Expand All @@ -414,7 +403,6 @@ func TestAppsService_FindUserInstallation(t *testing.T) {

mux.HandleFunc("/users/u/installation", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeIntegrationPreview)
fmt.Fprint(w, `{"id":1, "app_id":1, "target_id":1, "target_type": "User"}`)
})

Expand Down
6 changes: 0 additions & 6 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ const (
// https://developer.github.com/changes/2016-09-14-projects-api/
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"

// https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/
mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"

// https://developer.github.com/changes/2017-01-05-commit-search-api/
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"

Expand All @@ -89,9 +86,6 @@ const (
// https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"

// https://developer.github.com/changes/2018-01-10-lock-reason-api-preview/
mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json"

// https://developer.github.com/changes/2018-05-07-new-checks-api-public-beta/
mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json"

Expand Down
20 changes: 6 additions & 14 deletions github/issues.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 @@ -161,9 +160,8 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
return nil, nil, err
}

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

var issues []*Issue
resp, err := s.client.Do(ctx, req, &issues)
Expand Down Expand Up @@ -229,9 +227,8 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
return nil, nil, err
}

// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeIntegrationPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeReactionsPreview)

var issues []*Issue
resp, err := s.client.Do(ctx, req, &issues)
Expand All @@ -252,9 +249,8 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
return nil, nil, err
}

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

issue := new(Issue)
resp, err := s.client.Do(ctx, req, issue)
Expand Down Expand Up @@ -322,10 +318,6 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num
return nil, err
}

if opts != nil {
req.Header.Set("Accept", mediaTypeLockReasonPreview)
}

return s.client.Do(ctx, req, nil)
}

Expand Down
4 changes: 1 addition & 3 deletions github/issues_events.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 @@ -108,8 +107,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
return nil, nil, err
}

acceptHeaders := []string{mediaTypeLockReasonPreview, mediaTypeProjectCardDetailsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview)

var events []*IssueEvent
resp, err := s.client.Do(ctx, req, &events)
Expand Down
4 changes: 1 addition & 3 deletions github/issues_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ import (
"fmt"
"net/http"
"reflect"
"strings"
"testing"
)

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

wantAcceptHeaders := []string{mediaTypeLockReasonPreview, mediaTypeProjectCardDetailsPreview}
mux.HandleFunc("/repos/o/r/issues/1/events", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testHeader(t, r, "Accept", mediaTypeProjectCardDetailsPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
Expand Down
Loading