Make performs the request and parses the response.
(request *http.Request, passedResponse *Response, proxyReader ProxyReader)
| 39 | |
| 40 | // Make performs the request and parses the response. |
| 41 | func (connection *PluginConnection) Make(request *http.Request, passedResponse *Response, proxyReader ProxyReader) error { |
| 42 | // In case this function is called from a retry, passedResponse may already |
| 43 | // be populated with a previous response. We reset in case there's an HTTP |
| 44 | // error and we don't repopulate it in populateResponse. |
| 45 | passedResponse.reset() |
| 46 | |
| 47 | response, err := connection.HTTPClient.Do(request) |
| 48 | if err != nil { |
| 49 | return connection.processRequestErrors(request, err) |
| 50 | } |
| 51 | |
| 52 | body := response.Body |
| 53 | if proxyReader != nil { |
| 54 | proxyReader.Start(response.ContentLength) |
| 55 | defer proxyReader.Finish() |
| 56 | body = proxyReader.Wrap(response.Body) |
| 57 | } |
| 58 | |
| 59 | return connection.populateResponse(response, passedResponse, body) |
| 60 | } |
| 61 | |
| 62 | func (*PluginConnection) handleStatusCodes(response *http.Response, passedResponse *Response) error { |
| 63 | if response.StatusCode >= 400 { |
nothing calls this directly
no test coverage detected