MCPcopy Index your code
hub / github.com/cloudfoundry/cli / doRequestAndHandlerError

Method doRequestAndHandlerError

cf/net/gateway.go:385–399  ·  view source on GitHub ↗
(request *Request)

Source from the content-addressed store, hash-verified

383}
384
385func (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
401func (gateway Gateway) doRequest(request *http.Request) (*http.Response, error) {
402 var response *http.Response

Callers 1

doRequestHandlingAuthMethod · 0.95

Calls 3

doRequestMethod · 0.95
WrapNetworkErrorsFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected