(request *Request)
| 383 | } |
| 384 | |
| 385 | func (gateway Gateway) doRequestAndHandlerError(request *Request) (*http.Response, error) { |
| 386 | rawResponse, err := gateway.doRequest(request.HTTPReq) |
| 387 | if err != nil { |
| 388 | return rawResponse, WrapNetworkErrors(request.HTTPReq.URL.Host, err) |
| 389 | } |
| 390 | |
| 391 | if rawResponse.StatusCode > 299 { |
| 392 | defer rawResponse.Body.Close() |
| 393 | jsonBytes, _ := ioutil.ReadAll(rawResponse.Body) |
| 394 | rawResponse.Body = ioutil.NopCloser(bytes.NewBuffer(jsonBytes)) |
| 395 | err = gateway.errHandler(rawResponse.StatusCode, jsonBytes) |
| 396 | } |
| 397 | |
| 398 | return rawResponse, err |
| 399 | } |
| 400 | |
| 401 | func (gateway Gateway) doRequest(request *http.Request) (*http.Response, error) { |
| 402 | var response *http.Response |
no test coverage detected