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

Method Make

api/cloudcontroller/wrapper/retry_request.go:25–48  ·  view source on GitHub ↗

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

(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response)

Source from the content-addressed store, hash-verified

23
24// Make retries the request if it comes back with a 5XX status code.
25func (retry *RetryRequest) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error {
26 var err error
27
28 for i := 0; i < retry.maxRetries+1; i++ {
29 err = retry.connection.Make(request, passedResponse)
30 if err == nil {
31 return nil
32 }
33
34 if retry.skipRetry(request.Method, passedResponse.HTTPResponse) {
35 break
36 }
37
38 // Reset the request body prior to the next retry
39 resetErr := request.ResetBody()
40 if resetErr != nil {
41 if _, ok := resetErr.(ccerror.PipeSeekError); ok {
42 return ccerror.PipeSeekError{Err: err}
43 }
44 return resetErr
45 }
46 }
47 return err
48}
49
50// Wrap sets the connection in the RetryRequest and returns itself.
51func (retry *RetryRequest) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection {

Callers

nothing calls this directly

Calls 3

skipRetryMethod · 0.95
MakeMethod · 0.65
ResetBodyMethod · 0.45

Tested by

no test coverage detected