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

Method Make

api/plugin/wrapper/retry_request.go:26–52  ·  view source on GitHub ↗

Make retries the request if it comes back with a 5XX status code.

(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader)

Source from the content-addressed store, hash-verified

24
25// Make retries the request if it comes back with a 5XX status code.
26func (retry *RetryRequest) Make(request *http.Request, passedResponse *plugin.Response, proxyReader plugin.ProxyReader) error {
27 var err error
28 var rawRequestBody []byte
29
30 if request.Body != nil {
31 rawRequestBody, err = io.ReadAll(request.Body)
32 defer request.Body.Close()
33 if err != nil {
34 return err
35 }
36 }
37
38 for i := 0; i < retry.maxRetries+1; i++ {
39 if rawRequestBody != nil {
40 request.Body = io.NopCloser(bytes.NewBuffer(rawRequestBody))
41 }
42 err = retry.connection.Make(request, passedResponse, proxyReader)
43 if err == nil {
44 return nil
45 }
46
47 if retry.skipRetry(request.Method, passedResponse.HTTPResponse) {
48 break
49 }
50 }
51 return err
52}
53
54// Wrap sets the connection in the RetryRequest and returns itself.
55func (retry *RetryRequest) Wrap(innerconnection plugin.Connection) plugin.Connection {

Callers

nothing calls this directly

Calls 3

skipRetryMethod · 0.95
CloseMethod · 0.65
MakeMethod · 0.65

Tested by

no test coverage detected