Skip to content

Commit 1094add

Browse files
authored
Clean up unnecessary preview headers (#1782)
Fixes #1779.
1 parent 99529c4 commit 1094add

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

github/repos.go

-27
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,6 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re
920920
return nil, nil, err
921921
}
922922

923-
// TODO: remove custom Accept header when this API fully launches
924-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
925-
926923
var branches []*Branch
927924
resp, err := s.client.Do(ctx, req, &branches)
928925
if err != nil {
@@ -942,9 +939,6 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch
942939
return nil, nil, err
943940
}
944941

945-
// TODO: remove custom Accept header when this API fully launches
946-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
947-
948942
b := new(Branch)
949943
resp, err := s.client.Do(ctx, req, b)
950944
if err != nil {
@@ -986,9 +980,6 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner
986980
return nil, nil, err
987981
}
988982

989-
// TODO: remove custom Accept header when this API fully launches
990-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
991-
992983
p := new(RequiredStatusChecks)
993984
resp, err := s.client.Do(ctx, req, p)
994985
if err != nil {
@@ -1008,9 +999,6 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte
1008999
return nil, nil, err
10091000
}
10101001

1011-
// TODO: remove custom Accept header when this API fully launches
1012-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1013-
10141002
resp, err = s.client.Do(ctx, req, &contexts)
10151003
if err != nil {
10161004
return nil, resp, err
@@ -1051,9 +1039,6 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner,
10511039
return nil, err
10521040
}
10531041

1054-
// TODO: remove custom Accept header when this API fully launches
1055-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1056-
10571042
return s.client.Do(ctx, req, nil)
10581043
}
10591044

@@ -1252,9 +1237,6 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con
12521237
return nil, err
12531238
}
12541239

1255-
// TODO: remove custom Accept header when this API fully launches
1256-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1257-
12581240
return s.client.Do(ctx, req, nil)
12591241
}
12601242

@@ -1268,9 +1250,6 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re
12681250
return nil, nil, err
12691251
}
12701252

1271-
// TODO: remove custom Accept header when this API fully launches
1272-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1273-
12741253
r := new(AdminEnforcement)
12751254
resp, err := s.client.Do(ctx, req, r)
12761255
if err != nil {
@@ -1291,9 +1270,6 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re
12911270
return nil, nil, err
12921271
}
12931272

1294-
// TODO: remove custom Accept header when this API fully launches
1295-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1296-
12971273
r := new(AdminEnforcement)
12981274
resp, err := s.client.Do(ctx, req, r)
12991275
if err != nil {
@@ -1313,9 +1289,6 @@ func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner,
13131289
return nil, err
13141290
}
13151291

1316-
// TODO: remove custom Accept header when this API fully launches
1317-
req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
1318-
13191292
return s.client.Do(ctx, req, nil)
13201293
}
13211294

github/repos_test.go

-14
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,6 @@ func TestRepositoriesService_ListBranches(t *testing.T) {
841841

842842
mux.HandleFunc("/repos/o/r/branches", func(w http.ResponseWriter, r *http.Request) {
843843
testMethod(t, r, "GET")
844-
// TODO: remove custom Accept header when this API fully launches
845-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
846844
testFormValues(t, r, values{"page": "2"})
847845
fmt.Fprint(w, `[{"name":"master", "commit" : {"sha" : "a57781", "url" : "https://github.com/api/repos/o/r/commits/a57781"}}]`)
848846
})
@@ -883,8 +881,6 @@ func TestRepositoriesService_GetBranch(t *testing.T) {
883881

884882
mux.HandleFunc("/repos/o/r/branches/b", func(w http.ResponseWriter, r *http.Request) {
885883
testMethod(t, r, "GET")
886-
// TODO: remove custom Accept header when this API fully launches
887-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
888884
fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`)
889885
})
890886

@@ -1208,8 +1204,6 @@ func TestRepositoriesService_RemoveBranchProtection(t *testing.T) {
12081204

12091205
mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) {
12101206
testMethod(t, r, "DELETE")
1211-
// TODO: remove custom Accept header when this API fully launches
1212-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
12131207
w.WriteHeader(http.StatusNoContent)
12141208
})
12151209

@@ -1294,8 +1288,6 @@ func TestRepositoriesService_GetRequiredStatusChecks(t *testing.T) {
12941288
json.NewDecoder(r.Body).Decode(v)
12951289

12961290
testMethod(t, r, "GET")
1297-
// TODO: remove custom Accept header when this API fully launches
1298-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
12991291
fmt.Fprint(w, `{"strict": true,"contexts": ["x","y","z"]}`)
13001292
})
13011293

@@ -1414,8 +1406,6 @@ func TestRepositoriesService_ListRequiredStatusChecksContexts(t *testing.T) {
14141406
json.NewDecoder(r.Body).Decode(v)
14151407

14161408
testMethod(t, r, "GET")
1417-
// TODO: remove custom Accept header when this API fully launches
1418-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
14191409
fmt.Fprint(w, `["x", "y", "z"]`)
14201410
})
14211411

@@ -1622,7 +1612,6 @@ func TestRepositoriesService_RemovePullRequestReviewEnforcement(t *testing.T) {
16221612

16231613
mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) {
16241614
testMethod(t, r, "DELETE")
1625-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
16261615
w.WriteHeader(http.StatusNoContent)
16271616
})
16281617

@@ -1649,7 +1638,6 @@ func TestRepositoriesService_GetAdminEnforcement(t *testing.T) {
16491638

16501639
mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) {
16511640
testMethod(t, r, "GET")
1652-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
16531641
fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`)
16541642
})
16551643

@@ -1689,7 +1677,6 @@ func TestRepositoriesService_AddAdminEnforcement(t *testing.T) {
16891677

16901678
mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) {
16911679
testMethod(t, r, "POST")
1692-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
16931680
fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`)
16941681
})
16951682

@@ -1728,7 +1715,6 @@ func TestRepositoriesService_RemoveAdminEnforcement(t *testing.T) {
17281715

17291716
mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) {
17301717
testMethod(t, r, "DELETE")
1731-
testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
17321718
w.WriteHeader(http.StatusNoContent)
17331719
})
17341720

0 commit comments

Comments
 (0)