MCPcopy
hub / github.com/cli/cli / GraphQLQuery

Function GraphQLQuery

pkg/httpmock/stub.go:234–248  ·  view source on GitHub ↗
(body string, cb func(string, map[string]interface{}))

Source from the content-addressed store, hash-verified

232}
233
234func GraphQLQuery(body string, cb func(string, map[string]interface{})) Responder {
235 return func(req *http.Request) (*http.Response, error) {
236 var bodyData struct {
237 Query string
238 Variables map[string]interface{}
239 }
240 err := decodeJSONBody(req, &bodyData)
241 if err != nil {
242 return nil, err
243 }
244 cb(bodyData.Query, bodyData.Variables)
245
246 return httpResponse(200, req, bytes.NewBufferString(body)), nil
247 }
248}
249
250// ScopesResponder returns a response with a 200 status code and the given OAuth scopes.
251func ScopesResponder(scopes string) func(*http.Request) (*http.Response, error) {

Callers 15

TestListFunction · 0.92
TestSearchFunction · 0.92
Test_listRunFunction · 0.92
StubFetchReleaseFunction · 0.92
TestGetSessionFunction · 0.92
TestListRunFunction · 0.92
TestCloneRunFunction · 0.92
Test_listOrgsFunction · 0.92
TestDevelopRunFunction · 0.92

Calls 2

decodeJSONBodyFunction · 0.85
httpResponseFunction · 0.85

Tested by 15

TestListFunction · 0.74
TestSearchFunction · 0.74
Test_listRunFunction · 0.74
TestGetSessionFunction · 0.74
TestListRunFunction · 0.74
TestCloneRunFunction · 0.74
Test_listOrgsFunction · 0.74
TestDevelopRunFunction · 0.74