From 55c0777f11200b0a8041646ae83674c45699c1df Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 08:42:06 +0200
Subject: [PATCH 01/25] Remove preview header mediaTypeStarringPreview =
"application/vnd.github.v3.star+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/activity_star.go | 5 +----
github/activity_star_test.go | 5 ++---
github/github.go | 3 ---
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/github/activity_star.go b/github/activity_star.go
index ad07aac7526..0bdff7e72d6 100644
--- a/github/activity_star.go
+++ b/github/activity_star.go
@@ -38,9 +38,6 @@ func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeStarringPreview)
-
var stargazers []*Stargazer
resp, err := s.client.Do(ctx, req, &stargazers)
if err != nil {
@@ -87,7 +84,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac
}
// TODO: remove custom Accept header when APIs fully launch
- acceptHeaders := []string{mediaTypeStarringPreview, mediaTypeTopicsPreview}
+ acceptHeaders := []string{mediaTypeTopicsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var repos []*StarredRepository
diff --git a/github/activity_star_test.go b/github/activity_star_test.go
index 122c399366d..2890f87e522 100644
--- a/github/activity_star_test.go
+++ b/github/activity_star_test.go
@@ -22,7 +22,6 @@ func TestActivityService_ListStargazers(t *testing.T) {
mux.HandleFunc("/repos/o/r/stargazers", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeStarringPreview)
testFormValues(t, r, values{
"page": "2",
})
@@ -62,7 +61,7 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) {
mux.HandleFunc("/user/starred", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join([]string{mediaTypeStarringPreview, mediaTypeTopicsPreview}, ", "))
+ testHeader(t, r, "Accept", strings.Join([]string{mediaTypeTopicsPreview}, ", "))
fmt.Fprint(w, `[{"starred_at":"2002-02-10T15:30:00Z","repo":{"id":1}}]`)
})
@@ -98,7 +97,7 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) {
mux.HandleFunc("/users/u/starred", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join([]string{mediaTypeStarringPreview, mediaTypeTopicsPreview}, ", "))
+ testHeader(t, r, "Accept", strings.Join([]string{mediaTypeTopicsPreview}, ", "))
testFormValues(t, r, values{
"sort": "created",
"direction": "asc",
diff --git a/github/github.go b/github/github.go
index d4d7a54a7f1..2f8581b7000 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/
- mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
-
// https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
From 76e4ffea2422632edacb0b54e77e281268b11d03 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 08:46:57 +0200
Subject: [PATCH 02/25] Remove preview header mediaTypeMigrationsPreview =
"application/vnd.github.wyandotte-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/migrations.go | 18 ------------------
github/migrations_test.go | 6 ------
github/migrations_user.go | 18 ------------------
github/migrations_user_test.go | 6 ------
5 files changed, 51 deletions(-)
diff --git a/github/github.go b/github/github.go
index 2f8581b7000..167e26f6e34 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://help.github.com/enterprise/2.4/admin/guides/migrations/exporting-the-github-com-organization-s-repositories/
- mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
-
// https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/
mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json"
diff --git a/github/migrations.go b/github/migrations.go
index 7694021f1fb..4a1cb429adf 100644
--- a/github/migrations.go
+++ b/github/migrations.go
@@ -89,9 +89,6 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
m := &Migration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -116,9 +113,6 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
var m []*Migration
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -140,9 +134,6 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
m := &Migration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -164,9 +155,6 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string,
return "", err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
s.client.clientMu.Lock()
defer s.client.clientMu.Unlock()
@@ -201,9 +189,6 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -221,8 +206,5 @@ func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/migrations_test.go b/github/migrations_test.go
index 4a5c0fc6c06..74d29140f01 100644
--- a/github/migrations_test.go
+++ b/github/migrations_test.go
@@ -21,7 +21,6 @@ func TestMigrationService_StartMigration(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusCreated)
w.Write(migrationJSON)
@@ -61,7 +60,6 @@ func TestMigrationService_ListMigrations(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(fmt.Sprintf("[%s]", migrationJSON)))
@@ -97,7 +95,6 @@ func TestMigrationService_MigrationStatus(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusOK)
w.Write(migrationJSON)
@@ -133,7 +130,6 @@ func TestMigrationService_MigrationArchiveURL(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
http.Redirect(w, r, "/yo", http.StatusFound)
})
@@ -166,7 +162,6 @@ func TestMigrationService_DeleteMigration(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -193,7 +188,6 @@ func TestMigrationService_UnlockRepo(t *testing.T) {
mux.HandleFunc("/orgs/o/migrations/1/repos/r/lock", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusNoContent)
})
diff --git a/github/migrations_user.go b/github/migrations_user.go
index 5e8aaec5aa5..48aeb0ff4d1 100644
--- a/github/migrations_user.go
+++ b/github/migrations_user.go
@@ -82,9 +82,6 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
m := &UserMigration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -105,9 +102,6 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigra
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
var m []*UserMigration
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -129,9 +123,6 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
m := &UserMigration{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -153,9 +144,6 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64
return "", err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
m := &UserMigration{}
var loc string
@@ -187,9 +175,6 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -207,8 +192,5 @@ func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo st
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMigrationsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go
index 5a8905cd116..9102d7012dc 100644
--- a/github/migrations_user_test.go
+++ b/github/migrations_user_test.go
@@ -21,7 +21,6 @@ func TestMigrationService_StartUserMigration(t *testing.T) {
mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusCreated)
w.Write(userMigrationJSON)
@@ -59,7 +58,6 @@ func TestMigrationService_ListUserMigrations(t *testing.T) {
mux.HandleFunc("/user/migrations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(fmt.Sprintf("[%s]", userMigrationJSON)))
@@ -92,7 +90,6 @@ func TestMigrationService_UserMigrationStatus(t *testing.T) {
mux.HandleFunc("/user/migrations/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusOK)
w.Write(userMigrationJSON)
@@ -125,7 +122,6 @@ func TestMigrationService_UserMigrationArchiveURL(t *testing.T) {
mux.HandleFunc("/user/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
http.Redirect(w, r, "/go-github", http.StatusFound)
})
@@ -154,7 +150,6 @@ func TestMigrationService_DeleteUserMigration(t *testing.T) {
mux.HandleFunc("/user/migrations/1/archive", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -186,7 +181,6 @@ func TestMigrationService_UnlockUserRepo(t *testing.T) {
mux.HandleFunc("/user/migrations/1/repos/r/lock", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeMigrationsPreview)
w.WriteHeader(http.StatusNoContent)
})
From 54c02801ae8c420619f48cf6d76b30d209b50b1a Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 08:49:15 +0200
Subject: [PATCH 03/25] Remove preview header mediaTypeDeploymentStatusPreview
= "application/vnd.github.ant-man-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos_deployments.go | 8 ++++----
github/repos_deployments_test.go | 8 ++++----
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/github/github.go b/github/github.go
index 167e26f6e34..5dda86ed0b0 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/
- mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json"
-
// https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/
mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json"
diff --git a/github/repos_deployments.go b/github/repos_deployments.go
index 7308bcebe5a..2bd96f2c111 100644
--- a/github/repos_deployments.go
+++ b/github/repos_deployments.go
@@ -117,7 +117,7 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(Deployment)
@@ -189,7 +189,7 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner,
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var statuses []*DeploymentStatus
@@ -213,7 +213,7 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(DeploymentStatus)
@@ -237,7 +237,7 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner,
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(DeploymentStatus)
diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go
index c3d6637e37f..aa5e836405b 100644
--- a/github/repos_deployments_test.go
+++ b/github/repos_deployments_test.go
@@ -100,7 +100,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
@@ -176,7 +176,7 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -215,7 +215,7 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
mux.HandleFunc("/repos/o/r/deployments/3/statuses/4", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -259,7 +259,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+ wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
From 4ccaf8f30f448c89aafaabc76c74b55bd1859b5d Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 08:51:53 +0200
Subject: [PATCH 04/25] Remove preview header
mediaTypeExpandDeploymentStatusPreview =
"application/vnd.github.flash-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos_deployments.go | 17 -----------------
github/repos_deployments_test.go | 9 ---------
3 files changed, 29 deletions(-)
diff --git a/github/github.go b/github/github.go
index 5dda86ed0b0..bc95435315b 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/
- mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json"
-
// https://developer.github.com/changes/2016-05-12-reactions-api-preview/
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
diff --git a/github/repos_deployments.go b/github/repos_deployments.go
index 2bd96f2c111..fe80053d4aa 100644
--- a/github/repos_deployments.go
+++ b/github/repos_deployments.go
@@ -9,7 +9,6 @@ import (
"context"
"encoding/json"
"fmt"
- "strings"
)
// Deployment represents a deployment in a repo
@@ -116,10 +115,6 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
d := new(Deployment)
resp, err := s.client.Do(ctx, req, d)
if err != nil {
@@ -188,10 +183,6 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var statuses []*DeploymentStatus
resp, err := s.client.Do(ctx, req, &statuses)
if err != nil {
@@ -212,10 +203,6 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
d := new(DeploymentStatus)
resp, err := s.client.Do(ctx, req, d)
if err != nil {
@@ -236,10 +223,6 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
d := new(DeploymentStatus)
resp, err := s.client.Do(ctx, req, d)
if err != nil {
diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go
index aa5e836405b..01e864fc1c7 100644
--- a/github/repos_deployments_test.go
+++ b/github/repos_deployments_test.go
@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"net/http"
- "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -100,8 +99,6 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
@@ -176,10 +173,8 @@ func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
})
@@ -215,10 +210,8 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
mux.HandleFunc("/repos/o/r/deployments/3/statuses/4", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `{"id":4}`)
})
@@ -259,8 +252,6 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- wantAcceptHeaders := []string{mediaTypeExpandDeploymentStatusPreview}
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
From b0c59ecc4fa4b2a59af19863ff273efb9ad9c099 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:01:08 +0200
Subject: [PATCH 05/25] Remove preview header mediaTypeReactionsPreview =
"application/vnd.github.squirrel-girl-preview" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 -
github/issues.go | 9 -
github/issues_comments.go | 6 -
github/issues_comments_test.go | 3 -
github/issues_test.go | 5 -
github/pulls_comments.go | 6 +-
github/pulls_comments_test.go | 8 +-
github/reactions.go | 35 -
github/reactions_test.go | 26 +-
github/repos_comments.go | 9 -
github/repos_comments_test.go | 3 -
github/search.go | 4 -
update-urls/reactions_test.go | 2666 ++++++++++++++++----------------
13 files changed, 1306 insertions(+), 1477 deletions(-)
diff --git a/github/github.go b/github/github.go
index bc95435315b..deaea67d3a9 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2016-05-12-reactions-api-preview/
- mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
-
// https://developer.github.com/changes/2016-05-23-timeline-preview-api/
mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
diff --git a/github/issues.go b/github/issues.go
index 46aff2954bb..e5f698b5a28 100644
--- a/github/issues.go
+++ b/github/issues.go
@@ -160,9 +160,6 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis
return nil, nil, err
}
- // 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)
if err != nil {
@@ -227,9 +224,6 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin
return nil, nil, err
}
- // 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)
if err != nil {
@@ -249,9 +243,6 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb
return nil, nil, err
}
- // 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)
if err != nil {
diff --git a/github/issues_comments.go b/github/issues_comments.go
index 6dd6d13287c..31afb0b42c2 100644
--- a/github/issues_comments.go
+++ b/github/issues_comments.go
@@ -69,9 +69,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var comments []*IssueComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
@@ -92,9 +89,6 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
comment := new(IssueComment)
resp, err := s.client.Do(ctx, req, comment)
if err != nil {
diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go
index 7780676f086..75641b8b67c 100644
--- a/github/issues_comments_test.go
+++ b/github/issues_comments_test.go
@@ -22,7 +22,6 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{
"sort": "updated",
"direction": "desc",
@@ -71,7 +70,6 @@ func TestIssuesService_ListComments_specificIssue(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -116,7 +114,6 @@ func TestIssuesService_GetComment(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/comments/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `{"id":1}`)
})
diff --git a/github/issues_test.go b/github/issues_test.go
index 80bfb3ff6d2..6d2a168e3c4 100644
--- a/github/issues_test.go
+++ b/github/issues_test.go
@@ -22,7 +22,6 @@ func TestIssuesService_List_all(t *testing.T) {
mux.HandleFunc("/issues", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{
"filter": "all",
"state": "closed",
@@ -68,7 +67,6 @@ func TestIssuesService_List_owned(t *testing.T) {
mux.HandleFunc("/user/issues", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `[{"number":1}]`)
})
@@ -90,7 +88,6 @@ func TestIssuesService_ListByOrg(t *testing.T) {
mux.HandleFunc("/orgs/o/issues", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `[{"number":1}]`)
})
@@ -135,7 +132,6 @@ func TestIssuesService_ListByRepo(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{
"milestone": "*",
"state": "closed",
@@ -196,7 +192,6 @@ func TestIssuesService_Get(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `{"number":1, "author_association": "MEMBER","labels": [{"url": "u", "name": "n", "color": "c"}]}`)
})
diff --git a/github/pulls_comments.go b/github/pulls_comments.go
index 5078bab1d04..9c2581bff57 100644
--- a/github/pulls_comments.go
+++ b/github/pulls_comments.go
@@ -86,7 +86,7 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri
}
// TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var comments []*PullRequestComment
@@ -109,7 +109,7 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string
}
// TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
comment := new(PullRequestComment)
@@ -131,7 +131,7 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str
return nil, nil, err
}
// TODO: remove custom Accept headers when their respective API fully launches.
- acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
c := new(PullRequestComment)
diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go
index cd6f19c12c8..1b40530e303 100644
--- a/github/pulls_comments_test.go
+++ b/github/pulls_comments_test.go
@@ -137,7 +137,7 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -186,7 +186,7 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -218,7 +218,7 @@ func TestPullRequestsService_GetComment(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -266,7 +266,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) {
input := &PullRequestComment{Body: String("b")}
- wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview}
+ wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) {
v := new(PullRequestComment)
json.NewDecoder(r.Body).Decode(v)
diff --git a/github/reactions.go b/github/reactions.go
index 08387cb50f5..4c80f4b52fb 100644
--- a/github/reactions.go
+++ b/github/reactions.go
@@ -73,9 +73,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -100,9 +97,6 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -145,9 +139,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -172,9 +163,6 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -217,9 +205,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -244,9 +229,6 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -289,9 +271,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -316,9 +295,6 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -361,8 +337,6 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -385,8 +359,6 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -429,8 +401,6 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -452,8 +422,6 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -487,8 +455,5 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res
return nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/reactions_test.go b/github/reactions_test.go
index 3822a515c66..89eb9e48069 100644
--- a/github/reactions_test.go
+++ b/github/reactions_test.go
@@ -58,7 +58,7 @@ func TestReactions_Marshal(t *testing.T) {
"heart": 1,
"hooray": 1,
"rocket": 1,
- "eyes": 1,
+ "eyes": 1,
"url": "u"
}`
@@ -71,7 +71,6 @@ func TestReactionsService_ListCommentReactions(t *testing.T) {
mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{"content": "+1"})
fmt.Fprint(w, `[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)
@@ -109,7 +108,6 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -146,7 +144,6 @@ func TestReactionsService_ListIssueReactions(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
@@ -190,7 +187,6 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -227,7 +223,6 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
@@ -271,7 +266,6 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -308,7 +302,6 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) {
mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
@@ -352,7 +345,6 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -389,7 +381,6 @@ func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) {
mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
@@ -433,7 +424,6 @@ func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) {
mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -470,7 +460,6 @@ func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) {
mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusOK)
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
@@ -514,7 +503,6 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) {
mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
@@ -551,7 +539,6 @@ func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -578,7 +565,6 @@ func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) {
mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -605,7 +591,6 @@ func TestReactionsService_DeleteIssueReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1/reactions/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -632,7 +617,6 @@ func TestReactionsService_DeleteIssueReactionByRepoID(t *testing.T) {
mux.HandleFunc("/repositories/1/issues/2/reactions/3", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -659,7 +643,6 @@ func TestReactionsService_DeleteIssueCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -686,7 +669,6 @@ func TestReactionsService_DeleteIssueCommentReactionByRepoID(t *testing.T) {
mux.HandleFunc("/repositories/1/issues/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -713,7 +695,6 @@ func TestReactionsService_DeletePullRequestCommentReaction(t *testing.T) {
mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -740,7 +721,6 @@ func TestReactionsService_DeletePullRequestCommentReactionByRepoID(t *testing.T)
mux.HandleFunc("/repositories/1/pulls/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -767,7 +747,6 @@ func TestReactionsService_DeleteTeamDiscussionReaction(t *testing.T) {
mux.HandleFunc("/orgs/o/teams/s/discussions/1/reactions/2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -794,7 +773,6 @@ func TestReactionsService_DeleteTeamDiscussionReactionByTeamIDAndOrgID(t *testin
mux.HandleFunc("/organizations/1/team/2/discussions/3/reactions/4", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -821,7 +799,6 @@ func TestReactionsService_DeleteTeamDiscussionCommentReaction(t *testing.T) {
mux.HandleFunc("/orgs/o/teams/s/discussions/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -848,7 +825,6 @@ func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t
mux.HandleFunc("/organizations/1/team/2/discussions/3/comments/4/reactions/5", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
w.WriteHeader(http.StatusNoContent)
})
diff --git a/github/repos_comments.go b/github/repos_comments.go
index 912eeba3fb2..5e030457508 100644
--- a/github/repos_comments.go
+++ b/github/repos_comments.go
@@ -49,9 +49,6 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var comments []*RepositoryComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
@@ -76,9 +73,6 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var comments []*RepositoryComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
@@ -118,9 +112,6 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
c := new(RepositoryComment)
resp, err := s.client.Do(ctx, req, c)
if err != nil {
diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go
index 3dbc10cb474..150c681eef5 100644
--- a/github/repos_comments_test.go
+++ b/github/repos_comments_test.go
@@ -21,7 +21,6 @@ func TestRepositoriesService_ListComments(t *testing.T) {
mux.HandleFunc("/repos/o/r/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
})
@@ -68,7 +67,6 @@ func TestRepositoriesService_ListCommitComments(t *testing.T) {
mux.HandleFunc("/repos/o/r/commits/s/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
})
@@ -168,7 +166,6 @@ func TestRepositoriesService_GetComment(t *testing.T) {
mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeReactionsPreview)
fmt.Fprint(w, `{"id":1}`)
})
diff --git a/github/search.go b/github/search.go
index 19aa8927984..cec97e5d92f 100644
--- a/github/search.go
+++ b/github/search.go
@@ -284,10 +284,6 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter
// Accept header for search repositories based on topics preview endpoint
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeTopicsPreview)
- case searchType == "issues":
- // Accept header for search issues based on reactions preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
case opts != nil && opts.TextMatch:
// Accept header defaults to "application/vnd.github.v3+json"
// We change it here to fetch back text-match metadata
diff --git a/update-urls/reactions_test.go b/update-urls/reactions_test.go
index 7422a5951cc..1ecbc044431 100644
--- a/update-urls/reactions_test.go
+++ b/update-urls/reactions_test.go
@@ -140,46 +140,46 @@ var reactionsTestWebPage = `
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -198,7 +198,7 @@ var reactionsTestWebPage = `
GitHub Docs
-
+
-
+
-
-
+
+
@@ -559,165 +559,165 @@ var reactionsTestWebPage = `
-
+
-
+
-
+
@@ -762,27 +762,27 @@ var reactionsTestWebPage = `
@@ -790,16 +790,16 @@ var reactionsTestWebPage = `
@@ -818,118 +818,118 @@ var reactionsTestWebPage = `
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
+
When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):
@@ -1124,7 +1124,7 @@ var reactionsTestWebPage = `
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
+
@@ -1138,118 +1138,118 @@ var reactionsTestWebPage = `
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
comment_number
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a team discussion comment.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions' , {
org : 'org' ,
@@ -1263,10 +1263,10 @@ var reactionsTestWebPage = `
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -1298,22 +1298,22 @@ var reactionsTestWebPage = `
}
]
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1336,8 +1336,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -1351,7 +1351,7 @@ and creating reactions.
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
+
@@ -1365,87 +1365,87 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
comment_number
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the team discussion comment.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -1453,13 +1453,13 @@ and creating reactions.
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions' , {
org : 'org' ,
@@ -1474,10 +1474,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -1507,22 +1507,22 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1545,8 +1545,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -1560,7 +1560,7 @@ and creating reactions.
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
-
+
@@ -1574,99 +1574,99 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
comment_number
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}' , {
org : 'org' ,
@@ -1681,29 +1681,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1726,8 +1726,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -1741,7 +1741,7 @@ and creating reactions.
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
+
@@ -1755,108 +1755,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a team discussion.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions
-
-
-
+
+
+
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions' , {
org : 'org' ,
@@ -1869,10 +1869,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -1904,22 +1904,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -1942,8 +1942,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -1957,7 +1957,7 @@ and creating reactions.
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
+
@@ -1971,77 +1971,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the team discussion.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -2049,13 +2049,13 @@ and creating reactions.
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions' , {
org : 'org' ,
@@ -2069,10 +2069,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -2102,15 +2102,15 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
-
+
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2133,8 +2133,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -2148,7 +2148,7 @@ and creating reactions.
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
-
+
@@ -2162,89 +2162,89 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
org
string
path
-
-
+
+
-
+
team_slug
string
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}' , {
org : 'org' ,
@@ -2258,29 +2258,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2303,8 +2303,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -2318,7 +2318,7 @@ and creating reactions.
delete /reactions/{reaction_id}
-
+
@@ -2332,59 +2332,59 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /reactions/{reaction_id}' , {
reaction_id : 42 ,
@@ -2395,29 +2395,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2440,8 +2440,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -2454,7 +2454,7 @@ and creating reactions.
get /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
+
@@ -2468,108 +2468,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a commit comment.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -2582,10 +2582,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -2617,22 +2617,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2655,8 +2655,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -2669,7 +2669,7 @@ and creating reactions.
post /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
+
@@ -2683,77 +2683,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the commit comment.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -2761,13 +2761,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -2781,10 +2781,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -2814,22 +2814,22 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -2852,8 +2852,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -2867,7 +2867,7 @@ and creating reactions.
delete /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
-
+
@@ -2881,89 +2881,89 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}' , {
owner : 'octocat' ,
@@ -2977,29 +2977,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3022,8 +3022,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -3036,7 +3036,7 @@ and creating reactions.
get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
+
@@ -3050,108 +3050,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to an issue comment.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -3164,10 +3164,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -3199,22 +3199,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3237,8 +3237,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -3251,7 +3251,7 @@ and creating reactions.
post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
+
@@ -3265,77 +3265,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the issue comment.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -3343,13 +3343,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -3363,10 +3363,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -3396,22 +3396,22 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3434,8 +3434,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -3449,7 +3449,7 @@ and creating reactions.
delete /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
-
+
@@ -3463,89 +3463,89 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}' , {
owner : 'octocat' ,
@@ -3559,29 +3559,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3604,8 +3604,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -3618,7 +3618,7 @@ and creating reactions.
get /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
+
@@ -3632,108 +3632,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
issue_number
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to an issue.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions' , {
owner : 'octocat' ,
@@ -3746,10 +3746,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -3781,22 +3781,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -3819,8 +3819,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -3833,7 +3833,7 @@ and creating reactions.
post /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
+
@@ -3847,77 +3847,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
issue_number
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the issue.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -3925,13 +3925,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions' , {
owner : 'octocat' ,
@@ -3945,10 +3945,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -3978,15 +3978,15 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
-
+
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4009,8 +4009,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4024,7 +4024,7 @@ and creating reactions.
delete /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
-
+
@@ -4038,89 +4038,89 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
issue_number
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/issues/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}' , {
owner : 'octocat' ,
@@ -4134,29 +4134,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4179,8 +4179,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4193,7 +4193,7 @@ and creating reactions.
get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
+
@@ -4207,108 +4207,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a pull request review comment.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -4321,10 +4321,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -4356,22 +4356,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4394,8 +4394,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4408,7 +4408,7 @@ and creating reactions.
post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
+
@@ -4422,77 +4422,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the pull request review comment.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -4500,13 +4500,13 @@ and creating reactions.
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions' , {
owner : 'octocat' ,
@@ -4520,10 +4520,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -4553,22 +4553,22 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4591,8 +4591,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4606,7 +4606,7 @@ and creating reactions.
delete /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
-
+
@@ -4620,89 +4620,89 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
owner
string
path
-
-
+
+
-
+
repo
string
path
-
-
+
+
-
+
comment_id
integer
path
-
-
+
+
-
+
reaction_id
integer
path
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X DELETE \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions/42
-
-
-
+
+
+
await octokit.request('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}' , {
owner : 'octocat' ,
@@ -4716,29 +4716,29 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default Response
Status: 204 No Content
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4761,8 +4761,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4776,7 +4776,7 @@ and creating reactions.
get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
+
@@ -4790,108 +4790,108 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
team_id
integer
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
comment_number
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a team discussion comment.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/teams/42/discussions/42/comments/42/reactions
-
-
-
+
+
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions' , {
team_id : 42 ,
@@ -4904,10 +4904,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -4939,22 +4939,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -4977,8 +4977,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -4992,7 +4992,7 @@ and creating reactions.
post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
+
@@ -5006,77 +5006,77 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
team_id
integer
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
comment_number
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the team discussion comment.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -5084,13 +5084,13 @@ and creating reactions.
https://api.github.com/teams/42/discussions/42/comments/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions' , {
team_id : 42 ,
@@ -5104,10 +5104,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -5137,22 +5137,22 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
+
+
Notes
-
-
+
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5175,8 +5175,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -5190,7 +5190,7 @@ and creating reactions.
get /teams/{team_id}/discussions/{discussion_number}/reactions
-
+
@@ -5204,98 +5204,98 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
team_id
integer
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
+
content
string
query
Returns a single reaction type . Omit this parameter to list all reactions to a team discussion.
-
+
-
+
per_page
integer
query
Results per page (max 100)
-
+
-
+
page
integer
query
Page number of the results to fetch.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-H "Accept: application/vnd.github.squirrel-girl-preview+json" \
https://api.github.com/teams/42/discussions/42/reactions
-
-
-
+
+
+
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions' , {
team_id : 42 ,
@@ -5307,10 +5307,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 200 OK
[
@@ -5342,22 +5342,22 @@ and creating reactions.
}
]
-
-
+
+
Notes
-
-
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5380,8 +5380,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -5395,7 +5395,7 @@ and creating reactions.
post /teams/{team_id}/discussions/{discussion_number}/reactions
-
+
@@ -5409,67 +5409,67 @@ and creating reactions.
-
+
accept
string
header
This API is under preview and subject to change.
-
+
-
+
See preview notice.
-
-
+
+
-
+
team_id
integer
path
-
-
+
+
-
+
discussion_number
integer
path
-
-
+
+
-
-
+
+
content
string
body
Required . The reaction type to add to the team discussion.
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
Shell
-
+
curl \
-X POST \
@@ -5477,13 +5477,13 @@ and creating reactions.
https://api.github.com/teams/42/discussions/42/reactions \
-d '{"content":"content"}'
-
-
-
+
+
+
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions' , {
team_id : 42 ,
@@ -5496,10 +5496,10 @@ and creating reactions.
}
})
-
-
-
-
+
+
+
+
Default response
Status: 201 Created
{
@@ -5529,15 +5529,15 @@ and creating reactions.
"created_at" : "2016-05-20T20:09:31Z"
}
-
-
-
+
+
+
-
+
Preview notice
-
+
-
+
An additional reactions object in the issue comment payload is currently available for developers to preview. During
the preview period, the APIs may change without advance notice. Please see the blog
@@ -5560,8 +5560,8 @@ and creating reactions.
☝️ This header is
required .
-
-
+
+
@@ -5569,7 +5569,7 @@ and creating reactions.
-
+
-
+
@@ -5892,9 +5892,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -5919,9 +5916,6 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -5964,9 +5958,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -5991,9 +5982,6 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6036,9 +6024,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6063,9 +6048,6 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6108,9 +6090,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6135,9 +6114,6 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6180,8 +6156,6 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6204,8 +6178,6 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6248,8 +6220,6 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6271,8 +6241,6 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6306,9 +6274,6 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res
return nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
return s.client.Do(ctx, req, nil)
}
`
@@ -6384,9 +6349,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6411,9 +6373,6 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6456,9 +6415,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6483,9 +6439,6 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6528,9 +6481,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6555,9 +6505,6 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6600,9 +6547,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6627,9 +6571,6 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6672,8 +6613,6 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6696,8 +6635,6 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6740,8 +6677,6 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
@@ -6763,8 +6698,6 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
m := &Reaction{}
resp, err := s.client.Do(ctx, req, m)
if err != nil {
@@ -6798,9 +6731,6 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res
return nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeReactionsPreview)
-
return s.client.Do(ctx, req, nil)
}
`
From 23de7d5b601c87c1be67515af81db8c9bb6083cc Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:03:42 +0200
Subject: [PATCH 06/25] Remove preview header mediaTypeTimelinePreview =
"application/vnd.github.mockingbird-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/issues_timeline.go | 2 +-
github/issues_timeline_test.go | 2 +-
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/github/github.go b/github/github.go
index deaea67d3a9..3f5b314c8cc 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2016-05-23-timeline-preview-api/
- mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
-
// https://developer.github.com/changes/2016-09-14-projects-api/
mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
diff --git a/github/issues_timeline.go b/github/issues_timeline.go
index 1fd13b128c7..2e559cedb17 100644
--- a/github/issues_timeline.go
+++ b/github/issues_timeline.go
@@ -152,7 +152,7 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin
}
// TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview}
+ acceptHeaders := []string{mediaTypeProjectCardDetailsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var events []*Timeline
diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go
index 17ae6187beb..5e658f450ae 100644
--- a/github/issues_timeline_test.go
+++ b/github/issues_timeline_test.go
@@ -19,7 +19,7 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview}
+ wantAcceptHeaders := []string{mediaTypeProjectCardDetailsPreview}
mux.HandleFunc("/repos/o/r/issues/1/timeline", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
From 3b201b4c4d5e6ed7adc0010d7f2daf6cca68d922 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:10:28 +0200
Subject: [PATCH 07/25] Remove preview header mediaTypeProjectsPreview =
"application/vnd.github.inertia-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 --
github/orgs_projects.go | 6 ----
github/orgs_projects_test.go | 2 --
github/projects.go | 57 -----------------------------------
github/projects_test.go | 22 --------------
github/repos_projects.go | 6 ----
github/repos_projects_test.go | 2 --
github/teams.go | 32 --------------------
github/teams_test.go | 18 +----------
github/users_projects.go | 6 ----
github/users_projects_test.go | 2 --
11 files changed, 1 insertion(+), 155 deletions(-)
diff --git a/github/github.go b/github/github.go
index 3f5b314c8cc..b3d302e92ce 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2016-09-14-projects-api/
- mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
-
// https://developer.github.com/changes/2017-01-05-commit-search-api/
mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
diff --git a/github/orgs_projects.go b/github/orgs_projects.go
index b0c60ecb9e4..8e2bbe84391 100644
--- a/github/orgs_projects.go
+++ b/github/orgs_projects.go
@@ -25,9 +25,6 @@ func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -47,9 +44,6 @@ func (s *OrganizationsService) CreateProject(ctx context.Context, org string, op
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
project := &Project{}
resp, err := s.client.Do(ctx, req, project)
if err != nil {
diff --git a/github/orgs_projects_test.go b/github/orgs_projects_test.go
index 390917d4fac..cf6e2ed5dd5 100644
--- a/github/orgs_projects_test.go
+++ b/github/orgs_projects_test.go
@@ -21,7 +21,6 @@ func TestOrganizationsService_ListProjects(t *testing.T) {
mux.HandleFunc("/orgs/o/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{"state": "open", "page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -61,7 +60,6 @@ func TestOrganizationsService_CreateProject(t *testing.T) {
mux.HandleFunc("/orgs/o/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
diff --git a/github/projects.go b/github/projects.go
index 12c00bc3b70..77f9dd58727 100644
--- a/github/projects.go
+++ b/github/projects.go
@@ -49,9 +49,6 @@ func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
project := &Project{}
resp, err := s.client.Do(ctx, req, project)
if err != nil {
@@ -96,9 +93,6 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *Pro
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
project := &Project{}
resp, err := s.client.Do(ctx, req, project)
if err != nil {
@@ -118,9 +112,6 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Respons
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -153,9 +144,6 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
columns := []*ProjectColumn{}
resp, err := s.client.Do(ctx, req, &columns)
if err != nil {
@@ -175,9 +163,6 @@ func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*Proj
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
column := &ProjectColumn{}
resp, err := s.client.Do(ctx, req, column)
if err != nil {
@@ -205,9 +190,6 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
column := &ProjectColumn{}
resp, err := s.client.Do(ctx, req, column)
if err != nil {
@@ -227,9 +209,6 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
column := &ProjectColumn{}
resp, err := s.client.Do(ctx, req, column)
if err != nil {
@@ -249,9 +228,6 @@ func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int6
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -273,9 +249,6 @@ func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -329,9 +302,6 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
cards := []*ProjectCard{}
resp, err := s.client.Do(ctx, req, &cards)
if err != nil {
@@ -351,9 +321,6 @@ func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*Pr
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
card := &ProjectCard{}
resp, err := s.client.Do(ctx, req, card)
if err != nil {
@@ -389,9 +356,6 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64,
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
card := &ProjectCard{}
resp, err := s.client.Do(ctx, req, card)
if err != nil {
@@ -411,9 +375,6 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
card := &ProjectCard{}
resp, err := s.client.Do(ctx, req, card)
if err != nil {
@@ -433,9 +394,6 @@ func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -461,9 +419,6 @@ func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -491,9 +446,6 @@ func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -508,9 +460,6 @@ func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int6
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -549,9 +498,6 @@ func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
var users []*User
resp, err := s.client.Do(ctx, req, &users)
if err != nil {
@@ -582,9 +528,6 @@ func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Contex
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
ppl := new(ProjectPermissionLevel)
resp, err := s.client.Do(ctx, req, ppl)
if err != nil {
diff --git a/github/projects_test.go b/github/projects_test.go
index 6960ce90213..11c3ebeb8bb 100644
--- a/github/projects_test.go
+++ b/github/projects_test.go
@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"net/http"
- "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -99,7 +98,6 @@ func TestProjectsService_UpdateProject(t *testing.T) {
mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -142,7 +140,6 @@ func TestProjectsService_GetProject(t *testing.T) {
mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
fmt.Fprint(w, `{"id":1}`)
})
@@ -178,7 +175,6 @@ func TestProjectsService_DeleteProject(t *testing.T) {
mux.HandleFunc("/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
})
ctx := context.Background()
@@ -202,10 +198,8 @@ func TestProjectsService_ListProjectColumns(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/projects/1/columns", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -243,7 +237,6 @@ func TestProjectsService_GetProjectColumn(t *testing.T) {
mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
fmt.Fprint(w, `{"id":1}`)
})
@@ -281,7 +274,6 @@ func TestProjectsService_CreateProjectColumn(t *testing.T) {
mux.HandleFunc("/projects/1/columns", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectColumnOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -326,7 +318,6 @@ func TestProjectsService_UpdateProjectColumn(t *testing.T) {
mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectColumnOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -369,7 +360,6 @@ func TestProjectsService_DeleteProjectColumn(t *testing.T) {
mux.HandleFunc("/projects/columns/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
})
ctx := context.Background()
@@ -397,7 +387,6 @@ func TestProjectsService_MoveProjectColumn(t *testing.T) {
mux.HandleFunc("/projects/columns/1/moves", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectColumnMoveOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -429,7 +418,6 @@ func TestProjectsService_ListProjectCards(t *testing.T) {
mux.HandleFunc("/projects/columns/1/cards", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{
"archived_state": "all",
"page": "2"})
@@ -471,7 +459,6 @@ func TestProjectsService_GetProjectCard(t *testing.T) {
mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
fmt.Fprint(w, `{"id":1}`)
})
@@ -512,7 +499,6 @@ func TestProjectsService_CreateProjectCard(t *testing.T) {
mux.HandleFunc("/projects/columns/1/cards", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectCardOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -560,7 +546,6 @@ func TestProjectsService_UpdateProjectCard(t *testing.T) {
mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectCardOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -603,7 +588,6 @@ func TestProjectsService_DeleteProjectCard(t *testing.T) {
mux.HandleFunc("/projects/columns/cards/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
})
ctx := context.Background()
@@ -631,7 +615,6 @@ func TestProjectsService_MoveProjectCard(t *testing.T) {
mux.HandleFunc("/projects/columns/cards/1/moves", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectCardMoveOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -667,7 +650,6 @@ func TestProjectsService_AddProjectCollaborator(t *testing.T) {
mux.HandleFunc("/projects/1/collaborators/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectCollaboratorOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -710,7 +692,6 @@ func TestProjectsService_RemoveCollaborator(t *testing.T) {
mux.HandleFunc("/projects/1/collaborators/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -746,7 +727,6 @@ func TestProjectsService_ListCollaborators(t *testing.T) {
mux.HandleFunc("/projects/1/collaborators", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
})
@@ -786,7 +766,6 @@ func TestProjectsService_ListCollaborators_withAffiliation(t *testing.T) {
mux.HandleFunc("/projects/1/collaborators", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{"affiliation": "all", "page": "2"})
fmt.Fprintf(w, `[{"id":1}, {"id":2}]`)
})
@@ -813,7 +792,6 @@ func TestProjectsService_ReviewProjectCollaboratorPermission(t *testing.T) {
mux.HandleFunc("/projects/1/collaborators/u/permission", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
fmt.Fprintf(w, `{"permission":"admin","user":{"login":"u"}}`)
})
diff --git a/github/repos_projects.go b/github/repos_projects.go
index 1938d51b9bf..498660d0210 100644
--- a/github/repos_projects.go
+++ b/github/repos_projects.go
@@ -34,9 +34,6 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -56,9 +53,6 @@ func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo str
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
project := &Project{}
resp, err := s.client.Do(ctx, req, project)
if err != nil {
diff --git a/github/repos_projects_test.go b/github/repos_projects_test.go
index 558cc23a00a..8a0fc8f5132 100644
--- a/github/repos_projects_test.go
+++ b/github/repos_projects_test.go
@@ -21,7 +21,6 @@ func TestRepositoriesService_ListProjects(t *testing.T) {
mux.HandleFunc("/repos/o/r/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -61,7 +60,6 @@ func TestRepositoriesService_CreateProject(t *testing.T) {
mux.HandleFunc("/repos/o/r/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &ProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
diff --git a/github/teams.go b/github/teams.go
index 7a8a5d8a7b7..6d1ee847aa1 100644
--- a/github/teams.go
+++ b/github/teams.go
@@ -559,10 +559,6 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -583,10 +579,6 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -607,10 +599,6 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
projects := &Project{}
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -631,10 +619,6 @@ func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug s
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
projects := &Project{}
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -668,10 +652,6 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
return s.client.Do(ctx, req, nil)
}
@@ -687,10 +667,6 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
return s.client.Do(ctx, req, nil)
}
@@ -709,10 +685,6 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
return s.client.Do(ctx, req, nil)
}
@@ -731,10 +703,6 @@ func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug st
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/teams_test.go b/github/teams_test.go
index 748721c3a4d..8b97cf54c29 100644
--- a/github/teams_test.go
+++ b/github/teams_test.go
@@ -1016,10 +1016,8 @@ func TestTeamsService_ListProjectsByID(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/organizations/1/team/1/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -1053,10 +1051,8 @@ func TestTeamsService_ListProjectsBySlug(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/orgs/o/teams/s/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -1090,10 +1086,8 @@ func TestTeamsService_ReviewProjectsByID(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `{"id":1}`)
})
@@ -1127,10 +1121,8 @@ func TestTeamsService_ReviewProjectsBySlug(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `{"id":1}`)
})
@@ -1168,10 +1160,8 @@ func TestTeamsService_AddTeamProjectByID(t *testing.T) {
Permission: String("admin"),
}
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
v := &TeamProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -1207,10 +1197,8 @@ func TestTeamsService_AddTeamProjectBySlug(t *testing.T) {
Permission: String("admin"),
}
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
v := &TeamProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
@@ -1242,10 +1230,8 @@ func TestTeamsService_RemoveTeamProjectByID(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/organizations/1/team/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
w.WriteHeader(http.StatusNoContent)
})
@@ -1270,10 +1256,8 @@ func TestTeamsService_RemoveTeamProjectBySlug(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
w.WriteHeader(http.StatusNoContent)
})
@@ -1666,7 +1650,7 @@ func TestTeams_Marshal(t *testing.T) {
"members_count": 1,
"repos_count": 1
},
- "ldap_dn": "l"
+ "ldap_dn": "l"
}`
testJSONMarshal(t, u, want)
diff --git a/github/users_projects.go b/github/users_projects.go
index dd9ceaf2f88..2be0e98c88f 100644
--- a/github/users_projects.go
+++ b/github/users_projects.go
@@ -25,9 +25,6 @@ func (s *UsersService) ListProjects(ctx context.Context, user string, opts *Proj
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
@@ -55,9 +52,6 @@ func (s *UsersService) CreateProject(ctx context.Context, opts *CreateUserProjec
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeProjectsPreview)
-
project := &Project{}
resp, err := s.client.Do(ctx, req, project)
if err != nil {
diff --git a/github/users_projects_test.go b/github/users_projects_test.go
index 4f4b5e26407..c259bebeed3 100644
--- a/github/users_projects_test.go
+++ b/github/users_projects_test.go
@@ -21,7 +21,6 @@ func TestUsersService_ListProjects(t *testing.T) {
mux.HandleFunc("/users/u/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
testFormValues(t, r, values{"state": "open", "page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -61,7 +60,6 @@ func TestUsersService_CreateProject(t *testing.T) {
mux.HandleFunc("/user/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeProjectsPreview)
v := &CreateUserProjectOptions{}
json.NewDecoder(r.Body).Decode(v)
From 636f509efa821a979366ab6ff07445019ca2e105 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:12:06 +0200
Subject: [PATCH 08/25] Remove preview header mediaTypeCommitSearchPreview =
"application/vnd.github.cloak-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/search.go | 4 ----
2 files changed, 7 deletions(-)
diff --git a/github/github.go b/github/github.go
index b3d302e92ce..7d48628d943 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2017-01-05-commit-search-api/
- mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
-
// https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
diff --git a/github/search.go b/github/search.go
index cec97e5d92f..ac248950ca1 100644
--- a/github/search.go
+++ b/github/search.go
@@ -272,10 +272,6 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter
}
switch {
- case searchType == "commits":
- // Accept header for search commits preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeCommitSearchPreview)
case searchType == "topics":
// Accept header for search repositories based on topics preview endpoint
// TODO: remove custom Accept header when this API fully launches.
From fa084effba4dab29b00b4a0096b6770acce2b50d Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:14:38 +0200
Subject: [PATCH 09/25] Remove preview header mediaTypeBlockUsersPreview =
"application/vnd.github.giant-sentry-fist-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/orgs_users_blocking.go | 12 ------------
github/orgs_users_blocking_test.go | 4 ----
github/users_blocking.go | 12 ------------
github/users_blocking_test.go | 4 ----
5 files changed, 35 deletions(-)
diff --git a/github/github.go b/github/github.go
index 7d48628d943..51446416893 100644
--- a/github/github.go
+++ b/github/github.go
@@ -49,9 +49,6 @@ const (
// Media Type values to access preview APIs
- // https://developer.github.com/changes/2017-02-28-user-blocking-apis-and-webhook/
- mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
-
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
diff --git a/github/orgs_users_blocking.go b/github/orgs_users_blocking.go
index 2773344c9f3..072efc4a218 100644
--- a/github/orgs_users_blocking.go
+++ b/github/orgs_users_blocking.go
@@ -25,9 +25,6 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
var blockedUsers []*User
resp, err := s.client.Do(ctx, req, &blockedUsers)
if err != nil {
@@ -48,9 +45,6 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s
return false, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
resp, err := s.client.Do(ctx, req, nil)
isBlocked, err := parseBoolResponse(err)
return isBlocked, resp, err
@@ -67,9 +61,6 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -84,8 +75,5 @@ func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/orgs_users_blocking_test.go b/github/orgs_users_blocking_test.go
index 7d5b63b3d33..9dc423d7b0f 100644
--- a/github/orgs_users_blocking_test.go
+++ b/github/orgs_users_blocking_test.go
@@ -20,7 +20,6 @@ func TestOrganizationsService_ListBlockedUsers(t *testing.T) {
mux.HandleFunc("/orgs/o/blocks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{
"login": "octocat"
@@ -60,7 +59,6 @@ func TestOrganizationsService_IsBlocked(t *testing.T) {
mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -94,7 +92,6 @@ func TestOrganizationsService_BlockUser(t *testing.T) {
mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -121,7 +118,6 @@ func TestOrganizationsService_UnblockUser(t *testing.T) {
mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
diff --git a/github/users_blocking.go b/github/users_blocking.go
index cdbc2c25326..8241dcfe1e9 100644
--- a/github/users_blocking.go
+++ b/github/users_blocking.go
@@ -25,9 +25,6 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions)
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
var blockedUsers []*User
resp, err := s.client.Do(ctx, req, &blockedUsers)
if err != nil {
@@ -48,9 +45,6 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo
return false, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
resp, err := s.client.Do(ctx, req, nil)
isBlocked, err := parseBoolResponse(err)
return isBlocked, resp, err
@@ -67,9 +61,6 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -84,8 +75,5 @@ func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeBlockUsersPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/users_blocking_test.go b/github/users_blocking_test.go
index 55d8678495c..03cbbc01dd7 100644
--- a/github/users_blocking_test.go
+++ b/github/users_blocking_test.go
@@ -20,7 +20,6 @@ func TestUsersService_ListBlockedUsers(t *testing.T) {
mux.HandleFunc("/user/blocks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{
"login": "octocat"
@@ -55,7 +54,6 @@ func TestUsersService_IsBlocked(t *testing.T) {
mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -89,7 +87,6 @@ func TestUsersService_BlockUser(t *testing.T) {
mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -116,7 +113,6 @@ func TestUsersService_UnblockUser(t *testing.T) {
mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
w.WriteHeader(http.StatusNoContent)
})
From 474fe4c993de6a3bd34e424cb3fed5dad2472c30 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:18:34 +0200
Subject: [PATCH 10/25] Remove preview header mediaTypeTopicsPreview =
"application/vnd.github.mercy-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/activity_star.go | 5 -----
github/activity_star_test.go | 3 ---
github/apps_installation.go | 2 --
github/apps_installation_test.go | 2 --
github/github.go | 3 ---
github/repos.go | 11 ++---------
github/repos_forks.go | 3 ---
github/repos_forks_test.go | 1 -
github/repos_test.go | 15 +++++----------
github/search.go | 8 --------
github/teams.go | 8 --------
github/teams_test.go | 4 ----
12 files changed, 7 insertions(+), 58 deletions(-)
diff --git a/github/activity_star.go b/github/activity_star.go
index 0bdff7e72d6..2d5e7f88678 100644
--- a/github/activity_star.go
+++ b/github/activity_star.go
@@ -8,7 +8,6 @@ package github
import (
"context"
"fmt"
- "strings"
)
// StarredRepository is returned by ListStarred.
@@ -83,10 +82,6 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac
return nil, nil, err
}
- // TODO: remove custom Accept header when APIs fully launch
- acceptHeaders := []string{mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var repos []*StarredRepository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
diff --git a/github/activity_star_test.go b/github/activity_star_test.go
index 2890f87e522..c6809d4f427 100644
--- a/github/activity_star_test.go
+++ b/github/activity_star_test.go
@@ -9,7 +9,6 @@ import (
"context"
"fmt"
"net/http"
- "strings"
"testing"
"time"
@@ -61,7 +60,6 @@ func TestActivityService_ListStarred_authenticatedUser(t *testing.T) {
mux.HandleFunc("/user/starred", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join([]string{mediaTypeTopicsPreview}, ", "))
fmt.Fprint(w, `[{"starred_at":"2002-02-10T15:30:00Z","repo":{"id":1}}]`)
})
@@ -97,7 +95,6 @@ func TestActivityService_ListStarred_specifiedUser(t *testing.T) {
mux.HandleFunc("/users/u/starred", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join([]string{mediaTypeTopicsPreview}, ", "))
testFormValues(t, r, values{
"sort": "created",
"direction": "asc",
diff --git a/github/apps_installation.go b/github/apps_installation.go
index 521860d6ebd..9c918b807ac 100644
--- a/github/apps_installation.go
+++ b/github/apps_installation.go
@@ -33,7 +33,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{
- mediaTypeTopicsPreview,
mediaTypeRepositoryVisibilityPreview,
mediaTypeRepositoryTemplatePreview,
}
@@ -67,7 +66,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{
- mediaTypeTopicsPreview,
mediaTypeRepositoryVisibilityPreview,
mediaTypeRepositoryTemplatePreview,
}
diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go
index 56f0ad9e81d..c2a3dbcee6c 100644
--- a/github/apps_installation_test.go
+++ b/github/apps_installation_test.go
@@ -20,7 +20,6 @@ func TestAppsService_ListRepos(t *testing.T) {
defer teardown()
wantAcceptHeaders := []string{
- mediaTypeTopicsPreview,
mediaTypeRepositoryVisibilityPreview,
mediaTypeRepositoryTemplatePreview,
}
@@ -61,7 +60,6 @@ func TestAppsService_ListUserRepos(t *testing.T) {
defer teardown()
wantAcceptHeaders := []string{
- mediaTypeTopicsPreview,
mediaTypeRepositoryVisibilityPreview,
mediaTypeRepositoryTemplatePreview,
}
diff --git a/github/github.go b/github/github.go
index 51446416893..5825b943d3a 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2017-07-17-update-topics-on-repositories/
- mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
-
// https://developer.github.com/changes/2018-03-16-protected-branches-required-approving-reviews/
mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"
diff --git a/github/repos.go b/github/repos.go
index f6236b432f7..9ff9db0323f 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -206,7 +206,7 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opts *Repos
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var repos []*Repository
@@ -252,7 +252,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R
}
// TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var repos []*Repository
@@ -430,7 +430,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
// https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license
acceptHeaders := []string{
mediaTypeCodesOfConductPreview,
- mediaTypeTopicsPreview,
mediaTypeRepositoryTemplatePreview,
mediaTypeRepositoryVisibilityPreview,
}
@@ -1396,9 +1395,6 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
topics := new(repositoryTopics)
resp, err := s.client.Do(ctx, req, topics)
if err != nil {
@@ -1424,9 +1420,6 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
t = new(repositoryTopics)
resp, err := s.client.Do(ctx, req, t)
if err != nil {
diff --git a/github/repos_forks.go b/github/repos_forks.go
index 74b9b445ea6..4baa44882ad 100644
--- a/github/repos_forks.go
+++ b/github/repos_forks.go
@@ -37,9 +37,6 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string,
return nil, nil, err
}
- // TODO: remove custom Accept header when topics API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
-
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
diff --git a/github/repos_forks_test.go b/github/repos_forks_test.go
index 83b7a827812..4c3d228be80 100644
--- a/github/repos_forks_test.go
+++ b/github/repos_forks_test.go
@@ -20,7 +20,6 @@ func TestRepositoriesService_ListForks(t *testing.T) {
mux.HandleFunc("/repos/o/r/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
testFormValues(t, r, values{
"sort": "newest",
"page": "3",
diff --git a/github/repos_test.go b/github/repos_test.go
index 4c799048abb..00e42e204f3 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -22,7 +22,7 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -59,7 +59,7 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -96,7 +96,7 @@ func TestRepositoriesService_List_specifiedUser_type(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -134,7 +134,7 @@ func TestRepositoriesService_ListByOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -356,7 +356,7 @@ func TestRepositoriesService_Get(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -1959,7 +1959,6 @@ func TestRepositoriesService_ListAllTopics(t *testing.T) {
mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`)
})
@@ -1995,7 +1994,6 @@ func TestRepositoriesService_ListAllTopics_emptyTopics(t *testing.T) {
mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
fmt.Fprint(w, `{"names":[]}`)
})
@@ -2017,7 +2015,6 @@ func TestRepositoriesService_ReplaceAllTopics(t *testing.T) {
mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`)
})
@@ -2053,7 +2050,6 @@ func TestRepositoriesService_ReplaceAllTopics_nilSlice(t *testing.T) {
mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
testBody(t, r, `{"names":[]}`+"\n")
fmt.Fprint(w, `{"names":[]}`)
})
@@ -2076,7 +2072,6 @@ func TestRepositoriesService_ReplaceAllTopics_emptySlice(t *testing.T) {
mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeTopicsPreview)
testBody(t, r, `{"names":[]}`+"\n")
fmt.Fprint(w, `{"names":[]}`)
})
diff --git a/github/search.go b/github/search.go
index ac248950ca1..57a993324e2 100644
--- a/github/search.go
+++ b/github/search.go
@@ -272,14 +272,6 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter
}
switch {
- case searchType == "topics":
- // Accept header for search repositories based on topics preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
- case searchType == "repositories":
- // Accept header for search repositories based on topics preview endpoint
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeTopicsPreview)
case opts != nil && opts.TextMatch:
// Accept header defaults to "application/vnd.github.v3+json"
// We change it here to fetch back text-match metadata
diff --git a/github/teams.go b/github/teams.go
index 6d1ee847aa1..933fe58e54a 100644
--- a/github/teams.go
+++ b/github/teams.go
@@ -361,10 +361,6 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6
return nil, nil, err
}
- // TODO: remove custom Accept header when topics API fully launches.
- headers := []string{mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(headers, ", "))
-
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
@@ -389,10 +385,6 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string
return nil, nil, err
}
- // TODO: remove custom Accept header when topics API fully launches.
- headers := []string{mediaTypeTopicsPreview}
- req.Header.Set("Accept", strings.Join(headers, ", "))
-
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
diff --git a/github/teams_test.go b/github/teams_test.go
index 8b97cf54c29..80aeb14ca43 100644
--- a/github/teams_test.go
+++ b/github/teams_test.go
@@ -538,8 +538,6 @@ func TestTeamsService_ListTeamReposByID(t *testing.T) {
mux.HandleFunc("/organizations/1/team/1/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- wantAcceptHeaders := []string{mediaTypeTopicsPreview}
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
@@ -577,8 +575,6 @@ func TestTeamsService_ListTeamReposBySlug(t *testing.T) {
mux.HandleFunc("/orgs/o/teams/s/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- wantAcceptHeaders := []string{mediaTypeTopicsPreview}
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}]`)
})
From f8b5801ca83a4c4ddb71f69278a0b2f88d5c6435 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:21:30 +0200
Subject: [PATCH 11/25] Remove preview header
mediaTypeRequiredApprovingReviewsPreview =
"application/vnd.github.luke-cage-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos.go | 15 ---------------
github/repos_test.go | 12 ------------
3 files changed, 30 deletions(-)
diff --git a/github/github.go b/github/github.go
index 5825b943d3a..d795fb5532c 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // 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/enterprise/2.13/v3/repos/pre_receive_hooks/
mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
diff --git a/github/repos.go b/github/repos.go
index 9ff9db0323f..d6795b6b162 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -1046,9 +1046,6 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
-
p := new(Protection)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
@@ -1105,9 +1102,6 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
-
p := new(Protection)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
@@ -1252,9 +1246,6 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
-
r := new(PullRequestReviewsEnforcement)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -1275,9 +1266,6 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
-
r := new(PullRequestReviewsEnforcement)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -1303,9 +1291,6 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview)
-
r := new(PullRequestReviewsEnforcement)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
diff --git a/github/repos_test.go b/github/repos_test.go
index 00e42e204f3..431d70b4314 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -990,8 +990,6 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "GET")
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
fmt.Fprintf(w, `{
"required_status_checks":{
"strict":true,
@@ -1091,8 +1089,6 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test
mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
fmt.Fprintf(w, `{
"required_status_checks":{
"strict":true,
@@ -1181,8 +1177,6 @@ func TestRepositoriesService_UpdateBranchProtection(t *testing.T) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
fmt.Fprintf(w, `{
"required_status_checks":{
"strict":true,
@@ -1507,8 +1501,6 @@ func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) {
mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
fmt.Fprintf(w, `{
"dismissal_restrictions":{
"users":[{"id":1,"login":"u"}],
@@ -1578,8 +1570,6 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) {
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
fmt.Fprintf(w, `{
"dismissal_restrictions":{
"users":[{"id":1,"login":"u"}],
@@ -1635,8 +1625,6 @@ func TestRepositoriesService_DisableDismissalRestrictions(t *testing.T) {
mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
- // TODO: remove custom Accept header when this API fully launches
- testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview)
testBody(t, r, `{"dismissal_restrictions":{}}`+"\n")
fmt.Fprintf(w, `{"dismiss_stale_reviews":true,"require_code_owner_reviews":true,"required_approving_review_count":1}`)
})
From 356bc63a2b9b226f1c2a86e608308c9bac05f3dc Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:23:28 +0200
Subject: [PATCH 12/25] Remove preview header mediaTypePreReceiveHooksPreview =
"application/vnd.github.eye-scream-preview" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos_prereceive_hooks.go | 12 ------------
github/repos_prereceive_hooks_test.go | 2 --
3 files changed, 17 deletions(-)
diff --git a/github/github.go b/github/github.go
index d795fb5532c..1aac3b7b446 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/
- mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
-
// https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/
mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json"
diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go
index 1ce6478d33b..f56a2204900 100644
--- a/github/repos_prereceive_hooks.go
+++ b/github/repos_prereceive_hooks.go
@@ -37,9 +37,6 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
-
var hooks []*PreReceiveHook
resp, err := s.client.Do(ctx, req, &hooks)
if err != nil {
@@ -59,9 +56,6 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
-
h := new(PreReceiveHook)
resp, err := s.client.Do(ctx, req, h)
if err != nil {
@@ -81,9 +75,6 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
-
h := new(PreReceiveHook)
resp, err := s.client.Do(ctx, req, h)
if err != nil {
@@ -103,8 +94,5 @@ func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, r
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go
index 303e0e1265a..5dc455ed36d 100644
--- a/github/repos_prereceive_hooks_test.go
+++ b/github/repos_prereceive_hooks_test.go
@@ -21,7 +21,6 @@ func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) {
mux.HandleFunc("/repos/o/r/pre-receive-hooks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypePreReceiveHooksPreview)
testFormValues(t, r, values{"page": "2"})
fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
})
@@ -69,7 +68,6 @@ func TestRepositoriesService_GetPreReceiveHook(t *testing.T) {
mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypePreReceiveHooksPreview)
fmt.Fprint(w, `{"id":1}`)
})
From 54a607ca1ce877e621244822369d5f5c756c1ac8 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:29:16 +0200
Subject: [PATCH 13/25] Remove preview header mediaTypeSignaturePreview =
"application/vnd.github.zzzax-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos.go | 9 ---------
github/repos_test.go | 3 ---
3 files changed, 15 deletions(-)
diff --git a/github/github.go b/github/github.go
index 1aac3b7b446..cd491c37b57 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/
- mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json"
-
// https://developer.github.com/changes/2018-09-05-project-card-events/
mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json"
diff --git a/github/repos.go b/github/repos.go
index d6795b6b162..b83d1d0a01c 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -1134,9 +1134,6 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeSignaturePreview)
-
p := new(SignaturesProtectedBranch)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
@@ -1157,9 +1154,6 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeSignaturePreview)
-
r := new(SignaturesProtectedBranch)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -1179,9 +1173,6 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeSignaturePreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/repos_test.go b/github/repos_test.go
index 431d70b4314..96c73c311f0 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -1795,7 +1795,6 @@ func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) {
mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeSignaturePreview)
fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":false}`)
})
@@ -1835,7 +1834,6 @@ func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) {
mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeSignaturePreview)
fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":true}`)
})
@@ -1875,7 +1873,6 @@ func TestRepositoriesService_OptionalSignaturesOnProtectedBranch(t *testing.T) {
mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeSignaturePreview)
w.WriteHeader(http.StatusNoContent)
})
From a1839e699b4c59df645e1d0f7eaf59db3757834f Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:31:27 +0200
Subject: [PATCH 14/25] Remove preview header
mediaTypeProjectCardDetailsPreview =
"application/vnd.github.starfox-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/issues_events.go | 2 --
github/issues_events_test.go | 1 -
github/issues_timeline.go | 5 -----
github/issues_timeline_test.go | 3 ---
5 files changed, 14 deletions(-)
diff --git a/github/github.go b/github/github.go
index cd491c37b57..6d02750ebc9 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2018-09-05-project-card-events/
- mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json"
-
// https://developer.github.com/changes/2018-12-18-interactions-preview/
mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json"
diff --git a/github/issues_events.go b/github/issues_events.go
index 384779cfed8..928cddee419 100644
--- a/github/issues_events.go
+++ b/github/issues_events.go
@@ -113,8 +113,6 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview)
-
var events []*IssueEvent
resp, err := s.client.Do(ctx, req, &events)
if err != nil {
diff --git a/github/issues_events_test.go b/github/issues_events_test.go
index ba21565f2e8..e57e3fbce0d 100644
--- a/github/issues_events_test.go
+++ b/github/issues_events_test.go
@@ -20,7 +20,6 @@ func TestIssuesService_ListIssueEvents(t *testing.T) {
mux.HandleFunc("/repos/o/r/issues/1/events", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeProjectCardDetailsPreview)
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
diff --git a/github/issues_timeline.go b/github/issues_timeline.go
index 2e559cedb17..374b90d1ec7 100644
--- a/github/issues_timeline.go
+++ b/github/issues_timeline.go
@@ -8,7 +8,6 @@ package github
import (
"context"
"fmt"
- "strings"
"time"
)
@@ -151,10 +150,6 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeProjectCardDetailsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var events []*Timeline
resp, err := s.client.Do(ctx, req, &events)
return events, resp, err
diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go
index 5e658f450ae..c7a1e14ef6a 100644
--- a/github/issues_timeline_test.go
+++ b/github/issues_timeline_test.go
@@ -9,7 +9,6 @@ import (
"context"
"fmt"
"net/http"
- "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -19,10 +18,8 @@ func TestIssuesService_ListIssueTimeline(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeProjectCardDetailsPreview}
mux.HandleFunc("/repos/o/r/issues/1/timeline", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
From 119bfc8442f3a9bdd2a6c6431ab797174cae3c90 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:33:46 +0200
Subject: [PATCH 15/25] Remove preview header
mediaTypeInteractionRestrictionsPreview =
"application/vnd.github.sombra-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/interactions_orgs.go | 9 ---------
github/interactions_orgs_test.go | 3 ---
github/interactions_repos.go | 9 ---------
github/interactions_repos_test.go | 3 ---
5 files changed, 27 deletions(-)
diff --git a/github/github.go b/github/github.go
index 6d02750ebc9..9909791526f 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2018-12-18-interactions-preview/
- mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json"
-
// https://developer.github.com/changes/2019-03-14-enabling-disabling-pages/
mediaTypeEnablePagesAPIPreview = "application/vnd.github.switcheroo-preview+json"
diff --git a/github/interactions_orgs.go b/github/interactions_orgs.go
index d22a9e748d7..0403c7ffe2e 100644
--- a/github/interactions_orgs.go
+++ b/github/interactions_orgs.go
@@ -20,9 +20,6 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
organizationInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, organizationInteractions)
@@ -50,9 +47,6 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
organizationInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, organizationInteractions)
@@ -73,8 +67,5 @@ func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, org
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go
index 9258c92f502..cef89182be7 100644
--- a/github/interactions_orgs_test.go
+++ b/github/interactions_orgs_test.go
@@ -21,7 +21,6 @@ func TestInteractionsService_GetRestrictionsForOrgs(t *testing.T) {
mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
fmt.Fprint(w, `{"origin":"organization"}`)
})
@@ -62,7 +61,6 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
@@ -101,7 +99,6 @@ func TestInteractionsService_RemoveRestrictionsFromOrg(t *testing.T) {
mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
})
ctx := context.Background()
diff --git a/github/interactions_repos.go b/github/interactions_repos.go
index 13fffd64c0a..b6f1c30a5c7 100644
--- a/github/interactions_repos.go
+++ b/github/interactions_repos.go
@@ -20,9 +20,6 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
repositoryInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, repositoryInteractions)
@@ -50,9 +47,6 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
repositoryInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, repositoryInteractions)
@@ -73,8 +67,5 @@ func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, ow
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go
index 0a9f51245e4..73f14ddfb5e 100644
--- a/github/interactions_repos_test.go
+++ b/github/interactions_repos_test.go
@@ -21,7 +21,6 @@ func TestInteractionsService_GetRestrictionsForRepo(t *testing.T) {
mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
fmt.Fprint(w, `{"origin":"repository"}`)
})
@@ -62,7 +61,6 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}
@@ -101,7 +99,6 @@ func TestInteractionsService_RemoveRestrictionsFromRepo(t *testing.T) {
mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
})
ctx := context.Background()
From 2c9d9ae5a0b3373e7be680c20f05014e750b3140 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:35:29 +0200
Subject: [PATCH 16/25] Remove preview header mediaTypeEnablePagesAPIPreview =
"application/vnd.github.switcheroo-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos_pages.go | 5 -----
github/repos_pages_test.go | 2 --
3 files changed, 10 deletions(-)
diff --git a/github/github.go b/github/github.go
index 9909791526f..706ffbb545a 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-03-14-enabling-disabling-pages/
- mediaTypeEnablePagesAPIPreview = "application/vnd.github.switcheroo-preview+json"
-
// https://developer.github.com/changes/2019-04-24-vulnerability-alerts/
mediaTypeRequiredVulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json"
diff --git a/github/repos_pages.go b/github/repos_pages.go
index a954e70584b..9d40d426275 100644
--- a/github/repos_pages.go
+++ b/github/repos_pages.go
@@ -64,8 +64,6 @@ func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo strin
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview)
-
enable := new(Pages)
resp, err := s.client.Do(ctx, req, enable)
if err != nil {
@@ -114,9 +112,6 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go
index 85069f946c5..e08ad8dddf4 100644
--- a/github/repos_pages_test.go
+++ b/github/repos_pages_test.go
@@ -34,7 +34,6 @@ func TestRepositoriesService_EnablePages(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview)
want := &createPagesRequest{Source: &PagesSource{Branch: String("master"), Path: String("/")}}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
@@ -144,7 +143,6 @@ func TestRepositoriesService_DisablePages(t *testing.T) {
mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview)
})
ctx := context.Background()
From 2cc30883f31ce370c1b6957c60159020ab71b848 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:37:18 +0200
Subject: [PATCH 17/25] Remove preview header
mediaTypeRequiredVulnerabilityAlertsPreview =
"application/vnd.github.dorian-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos.go | 9 ---------
github/repos_test.go | 3 ---
3 files changed, 15 deletions(-)
diff --git a/github/github.go b/github/github.go
index 706ffbb545a..8e9351d4746 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-04-24-vulnerability-alerts/
- mediaTypeRequiredVulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json"
-
// https://developer.github.com/changes/2019-06-04-automated-security-fixes/
mediaTypeRequiredAutomatedSecurityFixesPreview = "application/vnd.github.london-preview+json"
diff --git a/github/repos.go b/github/repos.go
index b83d1d0a01c..cc5b068aa2c 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -564,9 +564,6 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner,
return false, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
-
resp, err := s.client.Do(ctx, req, nil)
vulnerabilityAlertsEnabled, err := parseBoolResponse(err)
@@ -584,9 +581,6 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -601,9 +595,6 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/repos_test.go b/github/repos_test.go
index 96c73c311f0..64445bac335 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -561,7 +561,6 @@ func TestRepositoriesService_GetVulnerabilityAlerts(t *testing.T) {
mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -597,7 +596,6 @@ func TestRepositoriesService_EnableVulnerabilityAlerts(t *testing.T) {
mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -624,7 +622,6 @@ func TestRepositoriesService_DisableVulnerabilityAlerts(t *testing.T) {
mux.HandleFunc("/repos/o/r/vulnerability-alerts", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeRequiredVulnerabilityAlertsPreview)
w.WriteHeader(http.StatusNoContent)
})
From 5e50bbeb3be0e94e564a1731577b310ca4949bd8 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:39:04 +0200
Subject: [PATCH 18/25] Remove preview header
mediaTypeRequiredAutomatedSecurityFixesPreview =
"application/vnd.github.london-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/repos.go | 6 ------
github/repos_test.go | 2 --
3 files changed, 11 deletions(-)
diff --git a/github/github.go b/github/github.go
index 8e9351d4746..a10b1c6895e 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-06-04-automated-security-fixes/
- mediaTypeRequiredAutomatedSecurityFixesPreview = "application/vnd.github.london-preview+json"
-
// https://developer.github.com/changes/2019-05-29-update-branch-api/
mediaTypeUpdatePullRequestBranchPreview = "application/vnd.github.lydian-preview+json"
diff --git a/github/repos.go b/github/repos.go
index cc5b068aa2c..54dbe90d9f6 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -609,9 +609,6 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview)
-
return s.client.Do(ctx, req, nil)
}
@@ -626,9 +623,6 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context,
return nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypeRequiredAutomatedSecurityFixesPreview)
-
return s.client.Do(ctx, req, nil)
}
diff --git a/github/repos_test.go b/github/repos_test.go
index 64445bac335..3f4a3cc15a4 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -648,7 +648,6 @@ func TestRepositoriesService_EnableAutomatedSecurityFixes(t *testing.T) {
mux.HandleFunc("/repos/o/r/automated-security-fixes", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeRequiredAutomatedSecurityFixesPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -665,7 +664,6 @@ func TestRepositoriesService_DisableAutomatedSecurityFixes(t *testing.T) {
mux.HandleFunc("/repos/o/r/automated-security-fixes", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
- testHeader(t, r, "Accept", mediaTypeRequiredAutomatedSecurityFixesPreview)
w.WriteHeader(http.StatusNoContent)
})
From 8ccdbbf105b7e248ded4db8cb6ca7fc1eeeb38dd Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:42:20 +0200
Subject: [PATCH 19/25] Remove preview header
mediaTypeUpdatePullRequestBranchPreview =
"application/vnd.github.lydian-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/pulls.go | 3 ---
github/pulls_test.go | 1 -
3 files changed, 7 deletions(-)
diff --git a/github/github.go b/github/github.go
index a10b1c6895e..12dd5c2f142 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-05-29-update-branch-api/
- mediaTypeUpdatePullRequestBranchPreview = "application/vnd.github.lydian-preview+json"
-
// https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/
mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json"
diff --git a/github/pulls.go b/github/pulls.go
index 6c866ea8840..c33474c1f37 100644
--- a/github/pulls.go
+++ b/github/pulls.go
@@ -301,9 +301,6 @@ func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeUpdatePullRequestBranchPreview)
-
p := new(PullRequestBranchUpdateResponse)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
diff --git a/github/pulls_test.go b/github/pulls_test.go
index b498193817d..3b1c0d6d0b4 100644
--- a/github/pulls_test.go
+++ b/github/pulls_test.go
@@ -417,7 +417,6 @@ func TestPullRequestsService_UpdateBranch(t *testing.T) {
mux.HandleFunc("/repos/o/r/pulls/1/update-branch", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
- testHeader(t, r, "Accept", mediaTypeUpdatePullRequestBranchPreview)
fmt.Fprint(w, `
{
"message": "Updating pull request branch.",
From 6df45659fcbb06ce1c7a37cc27045c9d2f21bbf5 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:45:51 +0200
Subject: [PATCH 20/25] Remove preview header
mediaTypeListPullsOrBranchesForCommitPreview =
"application/vnd.github.groot-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/pulls.go | 2 --
github/pulls_test.go | 1 -
github/repos_commits.go | 2 --
4 files changed, 8 deletions(-)
diff --git a/github/github.go b/github/github.go
index 12dd5c2f142..230aea48f5f 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/
- mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json"
-
// https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#repository-creation-permissions
mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
diff --git a/github/pulls.go b/github/pulls.go
index c33474c1f37..b35a2e263f9 100644
--- a/github/pulls.go
+++ b/github/pulls.go
@@ -182,8 +182,6 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview)
var pulls []*PullRequest
resp, err := s.client.Do(ctx, req, &pulls)
if err != nil {
diff --git a/github/pulls_test.go b/github/pulls_test.go
index 3b1c0d6d0b4..173b80541dd 100644
--- a/github/pulls_test.go
+++ b/github/pulls_test.go
@@ -67,7 +67,6 @@ func TestPullRequestsService_ListPullRequestsWithCommit(t *testing.T) {
mux.HandleFunc("/repos/o/r/commits/sha/pulls", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeListPullsOrBranchesForCommitPreview)
testFormValues(t, r, values{
"state": "closed",
"head": "h",
diff --git a/github/repos_commits.go b/github/repos_commits.go
index ce3b48e3c53..7e49ca2b511 100644
--- a/github/repos_commits.go
+++ b/github/repos_commits.go
@@ -300,8 +300,6 @@ func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview)
var branchCommits []*BranchCommit
resp, err := s.client.Do(ctx, req, &branchCommits)
if err != nil {
From 2d19de129f81ce11017268c25cd930f4d9a8e4c8 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:46:44 +0200
Subject: [PATCH 21/25] Remove preview header
mediaTypeMemberAllowedRepoCreationTypePreview =
"application/vnd.github.surtur-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/orgs.go | 6 ------
github/orgs_test.go | 2 --
3 files changed, 11 deletions(-)
diff --git a/github/github.go b/github/github.go
index 230aea48f5f..81bdbf60ecf 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#repository-creation-permissions
- mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
-
// https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#create-and-use-repository-templates
mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json"
diff --git a/github/orgs.go b/github/orgs.go
index 62f6ed241ca..0cdb12b4705 100644
--- a/github/orgs.go
+++ b/github/orgs.go
@@ -193,9 +193,6 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview)
-
organization := new(Organization)
resp, err := s.client.Do(ctx, req, organization)
if err != nil {
@@ -234,9 +231,6 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview)
-
o := new(Organization)
resp, err := s.client.Do(ctx, req, o)
if err != nil {
diff --git a/github/orgs_test.go b/github/orgs_test.go
index b30c48f1bce..930685ce68d 100644
--- a/github/orgs_test.go
+++ b/github/orgs_test.go
@@ -187,7 +187,6 @@ func TestOrganizationsService_Get(t *testing.T) {
mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview)
fmt.Fprint(w, `{"id":1, "login":"l", "url":"u", "avatar_url": "a", "location":"l"}`)
})
@@ -271,7 +270,6 @@ func TestOrganizationsService_Edit(t *testing.T) {
v := new(Organization)
json.NewDecoder(r.Body).Decode(v)
- testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview)
testMethod(t, r, "PATCH")
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
From 8260d02a431c56d39de83605714026235cec1783 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 09:51:47 +0200
Subject: [PATCH 22/25] Remove preview header
mediaTypeRepositoryTemplatePreview =
"application/vnd.github.baptiste-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/apps_installation.go | 2 --
github/apps_installation_test.go | 2 --
github/github.go | 3 ---
github/repos.go | 6 ++----
github/repos_test.go | 9 ++++-----
5 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/github/apps_installation.go b/github/apps_installation.go
index 9c918b807ac..f49dd864262 100644
--- a/github/apps_installation.go
+++ b/github/apps_installation.go
@@ -34,7 +34,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{
mediaTypeRepositoryVisibilityPreview,
- mediaTypeRepositoryTemplatePreview,
}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
@@ -67,7 +66,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{
mediaTypeRepositoryVisibilityPreview,
- mediaTypeRepositoryTemplatePreview,
}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go
index c2a3dbcee6c..7c8a1bf0b65 100644
--- a/github/apps_installation_test.go
+++ b/github/apps_installation_test.go
@@ -21,7 +21,6 @@ func TestAppsService_ListRepos(t *testing.T) {
wantAcceptHeaders := []string{
mediaTypeRepositoryVisibilityPreview,
- mediaTypeRepositoryTemplatePreview,
}
mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
@@ -61,7 +60,6 @@ func TestAppsService_ListUserRepos(t *testing.T) {
wantAcceptHeaders := []string{
mediaTypeRepositoryVisibilityPreview,
- mediaTypeRepositoryTemplatePreview,
}
mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
diff --git a/github/github.go b/github/github.go
index 81bdbf60ecf..fcc2ac45a94 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://docs.github.com/en/free-pro-team@latest/rest/reference/previews/#create-and-use-repository-templates
- mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json"
-
// https://developer.github.com/changes/2019-10-03-multi-line-comments/
mediaTypeMultiLineCommentsPreview = "application/vnd.github.comfort-fade-preview+json"
diff --git a/github/repos.go b/github/repos.go
index 54dbe90d9f6..ffdf917a054 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -373,7 +373,7 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
return nil, nil, err
}
- acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
@@ -406,7 +406,6 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview)
r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -430,7 +429,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
// https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license
acceptHeaders := []string{
mediaTypeCodesOfConductPreview,
- mediaTypeRepositoryTemplatePreview,
mediaTypeRepositoryVisibilityPreview,
}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
@@ -495,7 +493,7 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo
return nil, nil, err
}
- acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
diff --git a/github/repos_test.go b/github/repos_test.go
index 3f4a3cc15a4..a71ee276e6a 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -227,7 +227,7 @@ func TestRepositoriesService_Create_user(t *testing.T) {
Archived: Bool(true), // not passed along.
}
- wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
v := new(createRepoRequest)
json.NewDecoder(r.Body).Decode(v)
@@ -277,7 +277,7 @@ func TestRepositoriesService_Create_org(t *testing.T) {
Archived: Bool(true), // not passed along.
}
- wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) {
v := new(createRepoRequest)
json.NewDecoder(r.Body).Decode(v)
@@ -317,7 +317,6 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) {
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", mediaTypeRepositoryTemplatePreview)
want := &TemplateRepoRequest{Name: String("n")}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
@@ -356,7 +355,7 @@ func TestRepositoriesService_Get(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -473,7 +472,7 @@ func TestRepositoriesService_Edit(t *testing.T) {
i := true
input := &Repository{HasIssues: &i}
- wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
+ wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
v := new(Repository)
json.NewDecoder(r.Body).Decode(v)
From c9bae1593826befbcd867b239c624af120f1a3fd Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 10:04:38 +0200
Subject: [PATCH 23/25] Remove preview header mediaTypeMultiLineCommentsPreview
= "application/vnd.github.comfort-fade-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/github.go | 3 ---
github/pulls_comments.go | 12 ------------
github/pulls_comments_test.go | 10 ----------
github/pulls_reviews.go | 6 +-----
4 files changed, 1 insertion(+), 30 deletions(-)
diff --git a/github/github.go b/github/github.go
index fcc2ac45a94..01e2b25888a 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-10-03-multi-line-comments/
- mediaTypeMultiLineCommentsPreview = "application/vnd.github.comfort-fade-preview+json"
-
// https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/
mediaTypeOAuthAppPreview = "application/vnd.github.doctor-strange-preview+json"
diff --git a/github/pulls_comments.go b/github/pulls_comments.go
index 9c2581bff57..ea3323b5619 100644
--- a/github/pulls_comments.go
+++ b/github/pulls_comments.go
@@ -8,7 +8,6 @@ package github
import (
"context"
"fmt"
- "strings"
"time"
)
@@ -85,10 +84,6 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var comments []*PullRequestComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
@@ -108,10 +103,6 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches.
- acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
comment := new(PullRequestComment)
resp, err := s.client.Do(ctx, req, comment)
if err != nil {
@@ -130,9 +121,6 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str
if err != nil {
return nil, nil, err
}
- // TODO: remove custom Accept headers when their respective API fully launches.
- acceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
c := new(PullRequestComment)
resp, err := s.client.Do(ctx, req, c)
diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go
index 1b40530e303..1c2ba7f0608 100644
--- a/github/pulls_comments_test.go
+++ b/github/pulls_comments_test.go
@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"net/http"
- "strings"
"testing"
"time"
@@ -137,10 +136,8 @@ func TestPullRequestsService_ListComments_allPulls(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"sort": "updated",
"direction": "desc",
@@ -186,10 +183,8 @@ func TestPullRequestsService_ListComments_specificPull(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `[{"id":1, "pull_request_review_id":42}]`)
})
@@ -218,10 +213,8 @@ func TestPullRequestsService_GetComment(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `{"id":1}`)
})
@@ -266,13 +259,10 @@ func TestPullRequestsService_CreateComment(t *testing.T) {
input := &PullRequestComment{Body: String("b")}
- wantAcceptHeaders := []string{mediaTypeMultiLineCommentsPreview}
mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) {
v := new(PullRequestComment)
json.NewDecoder(r.Body).Decode(v)
- // TODO: remove custom Accept header assertion when the API fully launches.
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testMethod(t, r, "POST")
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go
index 437b0937be6..1f139e285b4 100644
--- a/github/pulls_reviews.go
+++ b/github/pulls_reviews.go
@@ -231,12 +231,8 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri
}
// Detect which style of review comment is being used.
- if isCF, err := review.isComfortFadePreview(); err != nil {
+ if _, err := review.isComfortFadePreview(); err != nil {
return nil, nil, err
- } else if isCF {
- // If the review comments are using the comfort fade preview fields,
- // then pass the comfort fade header.
- req.Header.Set("Accept", mediaTypeMultiLineCommentsPreview)
}
r := new(PullRequestReview)
From 9d5d9edc8f62037211fe2c38f97740573b03ca9c Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 10:06:14 +0200
Subject: [PATCH 24/25] Remove preview header mediaTypeOAuthAppPreview =
"application/vnd.github.doctor-strange-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/authorizations.go | 4 ----
github/authorizations_test.go | 4 ----
github/github.go | 3 ---
3 files changed, 11 deletions(-)
diff --git a/github/authorizations.go b/github/authorizations.go
index 76a14c3db10..94fbdb47b30 100644
--- a/github/authorizations.go
+++ b/github/authorizations.go
@@ -155,7 +155,6 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken
if err != nil {
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeOAuthAppPreview)
a := new(Authorization)
resp, err := s.client.Do(ctx, req, a)
@@ -188,7 +187,6 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken
if err != nil {
return nil, nil, err
}
- req.Header.Set("Accept", mediaTypeOAuthAppPreview)
a := new(Authorization)
resp, err := s.client.Do(ctx, req, a)
@@ -217,7 +215,6 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke
if err != nil {
return nil, err
}
- req.Header.Set("Accept", mediaTypeOAuthAppPreview)
return s.client.Do(ctx, req, nil)
}
@@ -238,7 +235,6 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces
if err != nil {
return nil, err
}
- req.Header.Set("Accept", mediaTypeOAuthAppPreview)
return s.client.Do(ctx, req, nil)
}
diff --git a/github/authorizations_test.go b/github/authorizations_test.go
index bd7ff29d811..a2128880bb4 100644
--- a/github/authorizations_test.go
+++ b/github/authorizations_test.go
@@ -21,7 +21,6 @@ func TestAuthorizationsService_Check(t *testing.T) {
mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testBody(t, r, `{"access_token":"a"}`+"\n")
- testHeader(t, r, "Accept", mediaTypeOAuthAppPreview)
fmt.Fprint(w, `{"id":1}`)
})
@@ -58,7 +57,6 @@ func TestAuthorizationsService_Reset(t *testing.T) {
mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
testBody(t, r, `{"access_token":"a"}`+"\n")
- testHeader(t, r, "Accept", mediaTypeOAuthAppPreview)
fmt.Fprint(w, `{"ID":1}`)
})
@@ -95,7 +93,6 @@ func TestAuthorizationsService_Revoke(t *testing.T) {
mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testBody(t, r, `{"access_token":"a"}`+"\n")
- testHeader(t, r, "Accept", mediaTypeOAuthAppPreview)
w.WriteHeader(http.StatusNoContent)
})
@@ -123,7 +120,6 @@ func TestDeleteGrant(t *testing.T) {
mux.HandleFunc("/applications/id/grant", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
testBody(t, r, `{"access_token":"a"}`+"\n")
- testHeader(t, r, "Accept", mediaTypeOAuthAppPreview)
})
ctx := context.Background()
diff --git a/github/github.go b/github/github.go
index 01e2b25888a..1aeb9b27c64 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/
- mediaTypeOAuthAppPreview = "application/vnd.github.doctor-strange-preview+json"
-
// https://developer.github.com/changes/2019-12-03-internal-visibility-changes/
mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json"
From 206432a3b90fc52a3e8c679d78c54481d3d52ee7 Mon Sep 17 00:00:00 2001
From: Andy Grunwald
Date: Fri, 15 Oct 2021 10:09:40 +0200
Subject: [PATCH 25/25] Remove preview header
mediaTypeRepositoryVisibilityPreview =
"application/vnd.github.nebula-preview+json" due to graduation
See https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/
---
github/apps_installation.go | 13 -------------
github/apps_installation_test.go | 9 ---------
github/github.go | 3 ---
github/repos.go | 13 -------------
github/repos_test.go | 17 -----------------
5 files changed, 55 deletions(-)
diff --git a/github/apps_installation.go b/github/apps_installation.go
index f49dd864262..b4ac5eefefd 100644
--- a/github/apps_installation.go
+++ b/github/apps_installation.go
@@ -8,7 +8,6 @@ package github
import (
"context"
"fmt"
- "strings"
)
// ListRepositories represents the response from the list repos endpoints.
@@ -31,12 +30,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{
- mediaTypeRepositoryVisibilityPreview,
- }
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var r *ListRepositories
resp, err := s.client.Do(ctx, req, &r)
@@ -63,12 +56,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{
- mediaTypeRepositoryVisibilityPreview,
- }
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var r *ListRepositories
resp, err := s.client.Do(ctx, req, &r)
if err != nil {
diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go
index 7c8a1bf0b65..643a8fe0a87 100644
--- a/github/apps_installation_test.go
+++ b/github/apps_installation_test.go
@@ -9,7 +9,6 @@ import (
"context"
"fmt"
"net/http"
- "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -19,12 +18,8 @@ func TestAppsService_ListRepos(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{
- mediaTypeRepositoryVisibilityPreview,
- }
mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
@@ -58,12 +53,8 @@ func TestAppsService_ListUserRepos(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{
- mediaTypeRepositoryVisibilityPreview,
- }
mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"page": "1",
"per_page": "2",
diff --git a/github/github.go b/github/github.go
index 1aeb9b27c64..25d87a83d4b 100644
--- a/github/github.go
+++ b/github/github.go
@@ -52,9 +52,6 @@ const (
// https://developer.github.com/changes/2017-05-23-coc-api/
mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
- // https://developer.github.com/changes/2019-12-03-internal-visibility-changes/
- mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json"
-
// https://developer.github.com/changes/2018-12-10-content-attachments-api/
mediaTypeContentAttachmentsPreview = "application/vnd.github.corsair-preview+json"
)
diff --git a/github/repos.go b/github/repos.go
index ffdf917a054..dfa0abba018 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -205,10 +205,6 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opts *Repos
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
@@ -251,10 +247,6 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R
return nil, nil, err
}
- // TODO: remove custom Accept headers when APIs fully launch.
- acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
-
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
@@ -373,8 +365,6 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
return nil, nil, err
}
- acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -429,7 +419,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep
// https://docs.github.com/en/free-pro-team@latest/rest/reference/licenses/#get-a-repositorys-license
acceptHeaders := []string{
mediaTypeCodesOfConductPreview,
- mediaTypeRepositoryVisibilityPreview,
}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
@@ -493,8 +482,6 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo
return nil, nil, err
}
- acceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
- req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
r := new(Repository)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
diff --git a/github/repos_test.go b/github/repos_test.go
index a71ee276e6a..7d1f02a5bb5 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -12,7 +12,6 @@ import (
"fmt"
"net/http"
"net/url"
- "strings"
"testing"
"github.com/google/go-cmp/cmp"
@@ -22,10 +21,8 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
@@ -59,10 +56,8 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"visibility": "public",
"affiliation": "owner,collaborator",
@@ -96,10 +91,8 @@ func TestRepositoriesService_List_specifiedUser_type(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"type": "owner",
})
@@ -134,10 +127,8 @@ func TestRepositoriesService_ListByOrg(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
testFormValues(t, r, values{
"type": "forks",
"page": "2",
@@ -227,13 +218,11 @@ func TestRepositoriesService_Create_user(t *testing.T) {
Archived: Bool(true), // not passed along.
}
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
v := new(createRepoRequest)
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
want := &createRepoRequest{Name: String("n")}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
@@ -277,13 +266,11 @@ func TestRepositoriesService_Create_org(t *testing.T) {
Archived: Bool(true), // not passed along.
}
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) {
v := new(createRepoRequest)
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "POST")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
want := &createRepoRequest{Name: String("n")}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
@@ -355,10 +342,8 @@ func TestRepositoriesService_Get(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
- wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"}}`)
})
@@ -472,13 +457,11 @@ func TestRepositoriesService_Edit(t *testing.T) {
i := true
input := &Repository{HasIssues: &i}
- wantAcceptHeaders := []string{mediaTypeRepositoryVisibilityPreview}
mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
v := new(Repository)
json.NewDecoder(r.Body).Decode(v)
testMethod(t, r, "PATCH")
- testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
if !cmp.Equal(v, input) {
t.Errorf("Request body = %+v, want %+v", v, input)
}