Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics/librato: ensure resp.body closed #26969

Merged
merged 16 commits into from
Mar 27, 2023
Merged
4 changes: 3 additions & 1 deletion metrics/librato/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ func (c *LibratoClient) PostMetrics(batch Batch) (err error) {
req.Header.Set("Content-Type", "application/json")
req.SetBasicAuth(c.Email, c.Token)

if resp, err = http.DefaultClient.Do(req); err != nil {
resp, err = http.DefaultClient.Do(req)
if err != nil {
return
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
var body []byte
Expand Down