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.
This commit is contained in:
parent
8a221bb766
commit
3a55c26000
2 changed files with 5 additions and 8 deletions
|
|
@ -88,13 +88,10 @@ func NewHTTPClient(io *iostreams.IOStreams, cfg configGetter, appVersion string,
|
||||||
if setAccept {
|
if setAccept {
|
||||||
opts = append(opts,
|
opts = append(opts,
|
||||||
api.AddHeaderFunc("Accept", func(req *http.Request) (string, error) {
|
api.AddHeaderFunc("Accept", func(req *http.Request) (string, error) {
|
||||||
// antiope-preview: Checks
|
accept := "application/vnd.github.merge-info-preview+json" // PullRequest.mergeStateStatus
|
||||||
accept := "application/vnd.github.antiope-preview+json"
|
|
||||||
// introduced for #2952: pr branch up to date status
|
|
||||||
accept += ", application/vnd.github.merge-info-preview+json"
|
|
||||||
if ghinstance.IsEnterprise(getHost(req)) {
|
if ghinstance.IsEnterprise(getHost(req)) {
|
||||||
// shadow-cat-preview: Draft pull requests
|
accept += ", application/vnd.github.antiope-preview" // Commit.statusCheckRollup
|
||||||
accept += ", application/vnd.github.shadow-cat-preview"
|
accept += ", application/vnd.github.shadow-cat-preview" // PullRequest.isDraft
|
||||||
}
|
}
|
||||||
return accept, nil
|
return accept, nil
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ func TestNewHTTPClient(t *testing.T) {
|
||||||
wantHeader: map[string]string{
|
wantHeader: map[string]string{
|
||||||
"authorization": "token MYTOKEN",
|
"authorization": "token MYTOKEN",
|
||||||
"user-agent": "GitHub CLI v1.2.3",
|
"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: "",
|
wantStderr: "",
|
||||||
},
|
},
|
||||||
|
|
@ -97,7 +97,7 @@ func TestNewHTTPClient(t *testing.T) {
|
||||||
wantHeader: map[string]string{
|
wantHeader: map[string]string{
|
||||||
"authorization": "token GHETOKEN",
|
"authorization": "token GHETOKEN",
|
||||||
"user-agent": "GitHub CLI v1.2.3",
|
"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: "",
|
wantStderr: "",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue