From 3a55c2600022d2c8d4f431acbf24e3f0425a822e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 8 Jun 2021 19:25:40 +0200 Subject: [PATCH] Update "Accept" header for github.com requests The `antiope-preview` has graduated in github.com and no longer needs activating. However, we still need it for GHES requests. --- pkg/cmd/factory/http.go | 9 +++------ pkg/cmd/factory/http_test.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/cmd/factory/http.go b/pkg/cmd/factory/http.go index 0005c6022..23534a0d3 100644 --- a/pkg/cmd/factory/http.go +++ b/pkg/cmd/factory/http.go @@ -88,13 +88,10 @@ func NewHTTPClient(io *iostreams.IOStreams, cfg configGetter, appVersion string, if setAccept { opts = append(opts, api.AddHeaderFunc("Accept", func(req *http.Request) (string, error) { - // antiope-preview: Checks - accept := "application/vnd.github.antiope-preview+json" - // introduced for #2952: pr branch up to date status - accept += ", application/vnd.github.merge-info-preview+json" + accept := "application/vnd.github.merge-info-preview+json" // PullRequest.mergeStateStatus if ghinstance.IsEnterprise(getHost(req)) { - // shadow-cat-preview: Draft pull requests - accept += ", application/vnd.github.shadow-cat-preview" + accept += ", application/vnd.github.antiope-preview" // Commit.statusCheckRollup + accept += ", application/vnd.github.shadow-cat-preview" // PullRequest.isDraft } return accept, nil }), diff --git a/pkg/cmd/factory/http_test.go b/pkg/cmd/factory/http_test.go index f52a8704f..296468f9a 100644 --- a/pkg/cmd/factory/http_test.go +++ b/pkg/cmd/factory/http_test.go @@ -39,7 +39,7 @@ func TestNewHTTPClient(t *testing.T) { wantHeader: map[string]string{ "authorization": "token MYTOKEN", "user-agent": "GitHub CLI v1.2.3", - "accept": "application/vnd.github.antiope-preview+json, application/vnd.github.merge-info-preview+json", + "accept": "application/vnd.github.merge-info-preview+json", }, wantStderr: "", }, @@ -97,7 +97,7 @@ func TestNewHTTPClient(t *testing.T) { wantHeader: map[string]string{ "authorization": "token GHETOKEN", "user-agent": "GitHub CLI v1.2.3", - "accept": "application/vnd.github.antiope-preview+json, application/vnd.github.merge-info-preview+json, application/vnd.github.shadow-cat-preview", + "accept": "application/vnd.github.merge-info-preview+json, application/vnd.github.antiope-preview, application/vnd.github.shadow-cat-preview", }, wantStderr: "", },