Skip to content

Commit

Permalink
sdk/client: conditionally return the error when the resp is nil whils…
Browse files Browse the repository at this point in the history
…t retrying the request, see manicminer/hamilton#280
  • Loading branch information
manicminer committed Apr 19, 2024
1 parent 773ed90 commit 547a2b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ func RequestRetryAll(retryFuncs ...RequestRetryFunc) func(resp *http.Response, o
// RetryableErrorHandler simply returns the resp and err, this is needed to make the Do() method
// of retryablehttp client return early with the response body not drained.
func RetryableErrorHandler(resp *http.Response, err error, _ int) (*http.Response, error) {
return resp, err
if resp == nil {
return nil, err
}

return resp, nil
}

// Request embeds *http.Request and adds useful metadata
Expand Down

0 comments on commit 547a2b7

Please sign in to comment.