@@ -39,9 +39,10 @@ func TestNewHTTPClient(t *testing.T) {
3939 },
4040 host : "github.com" ,
4141 wantHeader : map [string ][]string {
42- "authorization" : {"token MYTOKEN" },
43- "user-agent" : {"GitHub CLI v1.2.3" },
44- "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
42+ "authorization" : {"token MYTOKEN" },
43+ "user-agent" : {"GitHub CLI v1.2.3" },
44+ "x-github-api-version" : {"2022-11-28" },
45+ "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
4546 },
4647 wantStderr : "" ,
4748 },
@@ -53,9 +54,10 @@ func TestNewHTTPClient(t *testing.T) {
5354 },
5455 host : "example.com" ,
5556 wantHeader : map [string ][]string {
56- "authorization" : {"token GHETOKEN" },
57- "user-agent" : {"GitHub CLI v1.2.3" },
58- "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
57+ "authorization" : {"token GHETOKEN" },
58+ "user-agent" : {"GitHub CLI v1.2.3" },
59+ "x-github-api-version" : {"2022-11-28" },
60+ "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
5961 },
6062 wantStderr : "" ,
6163 },
@@ -68,9 +70,10 @@ func TestNewHTTPClient(t *testing.T) {
6870 },
6971 host : "github.com" ,
7072 wantHeader : map [string ][]string {
71- "authorization" : nil , // should not be set
72- "user-agent" : {"GitHub CLI v1.2.3" },
73- "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
73+ "authorization" : nil , // should not be set
74+ "user-agent" : {"GitHub CLI v1.2.3" },
75+ "x-github-api-version" : {"2022-11-28" },
76+ "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
7477 },
7578 wantStderr : "" ,
7679 },
@@ -83,9 +86,10 @@ func TestNewHTTPClient(t *testing.T) {
8386 },
8487 host : "example.com" ,
8588 wantHeader : map [string ][]string {
86- "authorization" : nil , // should not be set
87- "user-agent" : {"GitHub CLI v1.2.3" },
88- "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
89+ "authorization" : nil , // should not be set
90+ "user-agent" : {"GitHub CLI v1.2.3" },
91+ "x-github-api-version" : {"2022-11-28" },
92+ "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
8993 },
9094 wantStderr : "" ,
9195 },
@@ -98,9 +102,10 @@ func TestNewHTTPClient(t *testing.T) {
98102 },
99103 host : "github.com" ,
100104 wantHeader : map [string ][]string {
101- "authorization" : {"token MYTOKEN" },
102- "user-agent" : {"GitHub CLI v1.2.3" },
103- "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
105+ "authorization" : {"token MYTOKEN" },
106+ "user-agent" : {"GitHub CLI v1.2.3" },
107+ "x-github-api-version" : {"2022-11-28" },
108+ "accept" : {"application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" },
104109 },
105110 wantStderr : heredoc .Doc (`
106111 * Request at <time>
@@ -112,6 +117,7 @@ func TestNewHTTPClient(t *testing.T) {
112117 > Content-Type: application/json; charset=utf-8
113118 > Time-Zone: <timezone>
114119 > User-Agent: GitHub CLI v1.2.3
120+ > X-Github-Api-Version: 2022-11-28
115121
116122 < HTTP/1.1 204 No Content
117123 < Date: <time>
@@ -128,10 +134,11 @@ func TestNewHTTPClient(t *testing.T) {
128134 },
129135 host : "github.com" ,
130136 wantHeader : map [string ][]string {
131- "accept" : nil ,
132- "authorization" : nil ,
133- "content-type" : nil ,
134- "user-agent" : {"GitHub CLI v1.2.3" },
137+ "accept" : nil ,
138+ "authorization" : nil ,
139+ "content-type" : nil ,
140+ "user-agent" : {"GitHub CLI v1.2.3" },
141+ "x-github-api-version" : {"2022-11-28" },
135142 },
136143 wantStderr : heredoc .Doc (`
137144 * Request at <time>
@@ -140,6 +147,7 @@ func TestNewHTTPClient(t *testing.T) {
140147 > Host: github.com
141148 > Time-Zone: <timezone>
142149 > User-Agent: GitHub CLI v1.2.3
150+ > X-Github-Api-Version: 2022-11-28
143151
144152 < HTTP/1.1 204 No Content
145153 < Date: <time>
0 commit comments