(path string, body io.Reader)
| 398 | } |
| 399 | |
| 400 | func (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 | |
| 411 | func (c *Client) PostRequest(path string, body io.Reader) (*http.Request, error) { |
| 412 | return http.NewRequest(http.MethodPost, getURL(path), body) |