callAPI do the request.
(request *http.Request)
| 260 | |
| 261 | // callAPI do the request. |
| 262 | func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { |
| 263 | if c.cfg.Debug { |
| 264 | dump, err := httputil.DumpRequestOut(request, true) |
| 265 | if err != nil { |
| 266 | return nil, err |
| 267 | } |
| 268 | log.Printf("\n%s\n", string(dump)) |
| 269 | } |
| 270 | |
| 271 | resp, err := c.cfg.HTTPClient.Do(request) |
| 272 | if err != nil { |
| 273 | return resp, err |
| 274 | } |
| 275 | |
| 276 | if c.cfg.Debug { |
| 277 | dump, err := httputil.DumpResponse(resp, true) |
| 278 | if err != nil { |
| 279 | return resp, err |
| 280 | } |
| 281 | log.Printf("\n%s\n", string(dump)) |
| 282 | } |
| 283 | return resp, err |
| 284 | } |
| 285 | |
| 286 | // Allow modification of underlying config for alternate implementations and testing |
| 287 | // Caution: modifying the configuration while live can cause data races and potentially unwanted behavior |
no test coverage detected