Skip to content

Commit

Permalink
Explicitly ignore close body errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanoogian committed Dec 20, 2023
1 parent 613d73c commit b30de82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doppler/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ func (client APIClient) PerformRequest(req *http.Request, params []QueryParam) (

return nil, &APIError{Err: err, Message: "Unable to load response", RetryAfter: retryAfter}
}
defer r.Body.Close()
defer func() {
// G307: We're OK to ignore failures to close the body.
// If the body wasn't read properly, we would have failed to serialize the response.
_ = r.Body.Close()
}()

body, err := ioutil.ReadAll(r.Body)
response := &APIResponse{HTTPResponse: r, Body: body}
Expand Down

0 comments on commit b30de82

Please sign in to comment.