MCPcopy
hub / github.com/cloudfoundry/cli / performRequestForResponseBytes

Method performRequestForResponseBytes

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

Source from the content-addressed store, hash-verified

244}
245
246func (gateway Gateway) performRequestForResponseBytes(request *Request) ([]byte, http.Header, *http.Response, error) {
247 rawResponse, err := gateway.doRequestHandlingAuth(request)
248 if err != nil {
249 return nil, nil, rawResponse, err
250 }
251 defer rawResponse.Body.Close()
252
253 bytes, err := ioutil.ReadAll(rawResponse.Body)
254 if err != nil {
255 return bytes, nil, rawResponse, fmt.Errorf("%s: %s", T("Error reading response"), err.Error())
256 }
257
258 return bytes, rawResponse.Header, rawResponse, nil
259}
260
261func (gateway Gateway) PerformRequestForTextResponse(request *Request) (string, http.Header, error) {
262 bytes, headers, _, err := gateway.performRequestForResponseBytes(request)

Calls 3

doRequestHandlingAuthMethod · 0.95
CloseMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected