Skip to content

Commit

Permalink
Check error when reading body
Browse files Browse the repository at this point in the history
  • Loading branch information
tonerdo committed Mar 30, 2022
1 parent a2a9abb commit 0acf7fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/http-helper/http_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,13 @@ func HTTPDoWithRetryWithOptionsE(
t testing.TestingT, options HttpDoOptions, expectedStatus int,
retries int, sleepBetweenRetries time.Duration,
) (string, error) {
// The request body is closed after a request is complete. options.
// The request body is closed after a request is complete.
// Extract the underlying data and cache it so we can reuse for retried requests
data, err := io.ReadAll(options.Body)
if err != nil {
return "", err
}

options.Body = nil

out, err := retry.DoWithRetryE(
Expand Down

0 comments on commit 0acf7fc

Please sign in to comment.