MCPcopy
hub / github.com/livebud/bud / PostJSON

Method PostJSON

internal/testcli/testcli.go:400–409  ·  view source on GitHub ↗
(path string, body io.Reader)

Source from the content-addressed store, hash-verified

398}
399
400func (c *Client) PostJSON(path string, body io.Reader) (*Response, error) {
401 c.log.Debug("testcli: post json request %q", path)
402 req, err := c.PostRequest(path, body)
403 if err != nil {
404 return nil, err
405 }
406 req.Header.Set("Content-Type", "application/json")
407 req.Header.Set("Accept", "application/json")
408 return c.Do(req)
409}
410
411func (c *Client) PostRequest(path string, body io.Reader) (*http.Request, error) {
412 return http.NewRequest(http.MethodPost, getURL(path), body)

Callers 8

TestJSONCreate204Function · 0.80
TestJSONCreate500Function · 0.80
TestJSONCreateNestedFunction · 0.80
TestNestedResourceFunction · 0.80
TestDeepNestedResourceFunction · 0.80
TestResourceContextFunction · 0.80
TestRequestMapFunction · 0.80
TestInjectFunction · 0.80

Implementers 2

discardpackage/budhttp/discard.go
clientpackage/budhttp/client.go

Calls 4

PostRequestMethod · 0.95
DoMethod · 0.95
DebugMethod · 0.65
SetMethod · 0.65

Tested by 8

TestJSONCreate204Function · 0.64
TestJSONCreate500Function · 0.64
TestJSONCreateNestedFunction · 0.64
TestNestedResourceFunction · 0.64
TestDeepNestedResourceFunction · 0.64
TestResourceContextFunction · 0.64
TestRequestMapFunction · 0.64
TestInjectFunction · 0.64