MCPcopy Create free account
hub / github.com/mpolden/echoip / httpPost

Function httpPost

http/http_test.go:67–82  ·  view source on GitHub ↗
(url, body string)

Source from the content-addressed store, hash-verified

65}
66
67func httpPost(url, body string) (*http.Response, string, error) {
68 r, err := http.NewRequest(http.MethodPost, url, strings.NewReader(body))
69 if err != nil {
70 return nil, "", err
71 }
72 res, err := http.DefaultClient.Do(r)
73 if err != nil {
74 return nil, "", err
75 }
76 defer res.Body.Close()
77 data, err := ioutil.ReadAll(res.Body)
78 if err != nil {
79 return nil, "", err
80 }
81 return res, string(data), nil
82}
83
84func TestCLIHandlers(t *testing.T) {
85 log.SetOutput(ioutil.Discard)

Callers 1

TestCacheResizeHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected