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