MCPcopy Create free account
hub / github.com/algolia/cli / buildRequestWithBody

Method buildRequestWithBody

api/crawler/client.go:99–111  ·  view source on GitHub ↗

buildRequestWithBody builds an HTTP request with a body.

(method, url string, body interface{})

Source from the content-addressed store, hash-verified

97
98// buildRequestWithBody builds an HTTP request with a body.
99func (c *Client) buildRequestWithBody(method, url string, body interface{}) (*http.Request, error) {
100 var r io.ReadCloser
101 if body != nil {
102 b, err := json.Marshal(body)
103 if err != nil {
104 return nil, err
105 }
106
107 r = io.NopCloser(bytes.NewReader(b))
108 }
109
110 return http.NewRequest(method, url, r)
111}
112
113// buildRequest builds an HTTP request.
114func (c *Client) buildRequest(

Callers 1

buildRequestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected