MCPcopy
hub / github.com/mislav/hub / jsonRequest

Method jsonRequest

github/http.go:441–454  ·  view source on GitHub ↗
(method, path string, body interface{}, configure func(*http.Request))

Source from the content-addressed store, hash-verified

439}
440
441func (c *simpleClient) jsonRequest(method, path string, body interface{}, configure func(*http.Request)) (*simpleResponse, error) {
442 json, err := json.Marshal(body)
443 if err != nil {
444 return nil, err
445 }
446 buf := bytes.NewBuffer(json)
447
448 return c.performRequest(method, path, buf, func(req *http.Request) {
449 req.Header.Set("Content-Type", "application/json; charset=utf-8")
450 if configure != nil {
451 configure(req)
452 }
453 })
454}
455
456func (c *simpleClient) Get(path string) (*simpleResponse, error) {
457 return c.performRequest("GET", path, nil, nil)

Callers 3

PostJSONMethod · 0.95
PostJSONPreviewMethod · 0.95
PatchJSONMethod · 0.95

Calls 2

performRequestMethod · 0.95
SetMethod · 0.45

Tested by

no test coverage detected