(method, path string, body interface{}, configure func(*http.Request))
| 439 | } |
| 440 | |
| 441 | func (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 | |
| 456 | func (c *simpleClient) Get(path string) (*simpleResponse, error) { |
| 457 | return c.performRequest("GET", path, nil, nil) |
no test coverage detected