diff --git a/http/httpclient/client.go b/http/httpclient/client.go index 3beb5efe9..999a9ee95 100644 --- a/http/httpclient/client.go +++ b/http/httpclient/client.go @@ -131,7 +131,7 @@ func (jc *HttpClient) Send(method, url string, content []byte, followRedirect, c if resp == nil { return false, errorutils.CheckErrorf("%sReceived empty response from server", logMsgPrefix) } - if shouldRetry := jc.shouldRetry(resp, &httpClientsDetails); !shouldRetry { + if !jc.shouldRetry(resp, &httpClientsDetails) { return false, nil } // Perform retry diff --git a/utils/io/httputils/httpclient.go b/utils/io/httputils/httpclient.go index 4de19545c..9d86a7eb1 100644 --- a/utils/io/httputils/httpclient.go +++ b/utils/io/httputils/httpclient.go @@ -16,7 +16,8 @@ type HttpClientDetails struct { Transport *http.Transport DialTimeout time.Duration OverallRequestTimeout time.Duration - PreRetryInterceptors []PreRetryInterceptor + // Prior to each retry attempt, the list of PreRetryInterceptors is invoked sequentially. If any of these interceptors yields a 'false' response, the retry process stops instantly. + PreRetryInterceptors []PreRetryInterceptor } type PreRetryInterceptor func() (shouldRetry bool)