MCPcopy
hub / github.com/cli/cli / GraphQLMutation

Function GraphQLMutation

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

Source from the content-addressed store, hash-verified

215}
216
217func GraphQLMutation(body string, cb func(map[string]interface{})) Responder {
218 return func(req *http.Request) (*http.Response, error) {
219 var bodyData struct {
220 Variables struct {
221 Input map[string]interface{}
222 }
223 }
224 err := decodeJSONBody(req, &bodyData)
225 if err != nil {
226 return nil, err
227 }
228 cb(bodyData.Variables.Input)
229
230 return httpResponse(200, req, bytes.NewBufferString(body)), nil
231 }
232}
233
234func GraphQLQuery(body string, cb func(string, map[string]interface{})) Responder {
235 return func(req *http.Request) (*http.Response, error) {

Callers 15

TestCloseRunFunction · 0.92
TestUnpinRunFunction · 0.92
TestDevelopRunFunction · 0.92
TestIssueReopenFunction · 0.92
TestIssueDeleteFunction · 0.92
TestIssueDelete_confirmFunction · 0.92
TestPinRunFunction · 0.92
mockCommentCreateFunction · 0.92
mockCommentUpdateFunction · 0.92
mockCommentDeleteFunction · 0.92

Calls 2

decodeJSONBodyFunction · 0.85
httpResponseFunction · 0.85

Tested by 15

TestCloseRunFunction · 0.74
TestUnpinRunFunction · 0.74
TestDevelopRunFunction · 0.74
TestIssueReopenFunction · 0.74
TestIssueDeleteFunction · 0.74
TestIssueDelete_confirmFunction · 0.74
TestPinRunFunction · 0.74
mockCommentCreateFunction · 0.74
mockCommentUpdateFunction · 0.74
mockCommentDeleteFunction · 0.74