MCPcopy Create free account
hub / github.com/cloudfoundry/cli / Make

Method Make

api/cfnetworking/wrapper/retry_request.go:30–54  ·  view source on GitHub ↗

Make retries the request if it comes back with certain status codes.

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

Source from the content-addressed store, hash-verified

28
29// Make retries the request if it comes back with certain status codes.
30func (retry *RetryRequest) Make(request *cfnetworking.Request, passedResponse *cfnetworking.Response) error {
31 var err error
32
33 for i := 0; i < retry.maxRetries+1; i += 1 {
34 err = retry.connection.Make(request, passedResponse)
35 if err == nil {
36 return nil
37 }
38
39 if passedResponse.HTTPResponse != nil &&
40 (passedResponse.HTTPResponse.StatusCode == http.StatusBadGateway ||
41 passedResponse.HTTPResponse.StatusCode == http.StatusServiceUnavailable ||
42 passedResponse.HTTPResponse.StatusCode == http.StatusGatewayTimeout ||
43 (passedResponse.HTTPResponse.StatusCode >= 400 && passedResponse.HTTPResponse.StatusCode < 500)) {
44 break
45 }
46
47 // Reset the request body prior to the next retry
48 resetErr := request.ResetBody()
49 if resetErr != nil {
50 return resetErr
51 }
52 }
53 return err
54}

Callers

nothing calls this directly

Calls 2

MakeMethod · 0.65
ResetBodyMethod · 0.45

Tested by

no test coverage detected