MCPcopy Create free account
hub / github.com/cli/cli / TestGraphQLWithHeader

Function TestGraphQLWithHeader

api/request_test.go:380–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

378}
379
380func TestGraphQLWithHeader(t *testing.T) {
381 reg := &httpmock.Registry{}
382 defer reg.Verify(t)
383 client := newTestClient(reg)
384
385 reg.Register(httpmock.MatchAny, httpmock.StatusStringResponse(200, `{"data": {}}`))
386
387 var response struct{}
388 err := client.GraphQL("github.com", "query{}", nil, &response,
389 WithHeader("Authorization", "token explicit-token"))
390 require.NoError(t, err)
391
392 assert.Equal(t, "token explicit-token", reg.Requests[0].Header.Get("Authorization"))
393}
394
395// TestDoRequestPreservesCheckRedirect pins the difference between Request and DoRequest that
396// motivates DoRequest existing for redirect-sensitive call sites. Request delegates to go-gh,

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
StatusStringResponseFunction · 0.92
newTestClientFunction · 0.85
GraphQLMethod · 0.80
EqualMethod · 0.80
WithHeaderFunction · 0.70
GetMethod · 0.65

Tested by

no test coverage detected