-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
Related to #5158
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -124,6 +124,7 @@ func attemptHttpCall(client *http.Client, request *http.Request) (*http.Response | |||
if err != nil { | ||||
return nil, fmt.Errorf("problem calling http loader url: %v", err) | ||||
} else if resp.StatusCode < 200 || resp.StatusCode > 499 { | ||||
resp.Body.Close() | ||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mholt
Author
Member
|
defer resp.Body.Close() |
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
mholt
Oct 29, 2022
Author
Member
Ah, thanks for digging into that! That's good to know.
As for closing multiple times, I'm not so sure about that. In this branch we don't return the response, we return an error and a nil response.
Do we not need to drain the body?