@@ -165,9 +165,10 @@ func TestHTTPPayloadCreation(t *testing.T) {
165165 for _ , tt := range tests {
166166 t .Run (tt .name , func (t * testing.T ) {
167167 payload , err := json .Marshal (map [string ]string {
168- "query" : tt .query ,
169- "version" : tt .version ,
170- "language" : "en" ,
168+ "query" : tt .query ,
169+ "version" : tt .version ,
170+ "language" : "en" ,
171+ "client_name" : "gh-ask-docs" ,
171172 })
172173 if err != nil {
173174 t .Fatalf ("Failed to create payload: %v" , err )
@@ -190,6 +191,10 @@ func TestHTTPPayloadCreation(t *testing.T) {
190191 if parsed ["language" ] != "en" {
191192 t .Errorf ("Language = %q, want %q" , parsed ["language" ], "en" )
192193 }
194+
195+ if parsed ["client_name" ] != "gh-ask-docs" {
196+ t .Errorf ("Client name = %q, want %q" , parsed ["client_name" ], "gh-ask-docs" )
197+ }
193198 })
194199 }
195200}
@@ -309,9 +314,10 @@ func TestNDJSONResponseParsing(t *testing.T) {
309314
310315func TestHTTPRequestCreation (t * testing.T ) {
311316 payload , _ := json .Marshal (map [string ]string {
312- "query" : "test query" ,
313- "version" : "free-pro-team@latest" ,
314- "language" : "en" ,
317+ "query" : "test query" ,
318+ "version" : "free-pro-team@latest" ,
319+ "language" : "en" ,
320+ "client_name" : "gh-ask-docs" ,
315321 })
316322
317323 req , err := http .NewRequest (http .MethodPost , endpoint , bytes .NewReader (payload ))
@@ -429,9 +435,10 @@ func TestMockHTTPServer(t *testing.T) {
429435
430436 // Test making a request to our mock server
431437 payload , _ := json .Marshal (map [string ]string {
432- "query" : "What is GitHub?" ,
433- "version" : "free-pro-team@latest" ,
434- "language" : "en" ,
438+ "query" : "What is GitHub?" ,
439+ "version" : "free-pro-team@latest" ,
440+ "language" : "en" ,
441+ "client_name" : "gh-ask-docs" ,
435442 })
436443
437444 req , _ := http .NewRequest (http .MethodPost , server .URL , bytes .NewReader (payload ))
0 commit comments