chore: fix a couple of unclosed http connections (#10806)
Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -407,6 +407,7 @@ func (c *idCheckingHTTPClient) Get(ctx context.Context, url string) (*http.Respo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := c.check(resp); err != nil {
|
if err := c.check(resp); err != nil {
|
||||||
|
resp.Body.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,6 +420,7 @@ func (c *idCheckingHTTPClient) Post(ctx context.Context, url, ctype string, data
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := c.check(resp); err != nil {
|
if err := c.check(resp); err != nil {
|
||||||
|
resp.Body.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -607,6 +607,7 @@ func soapRequestWithIP(ctx context.Context, url, service, function, message stri
|
|||||||
l.Debugln("SOAP do:", err)
|
l.Debugln("SOAP do:", err)
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
defer r.Body.Close()
|
||||||
|
|
||||||
resp, err = io.ReadAll(r.Body)
|
resp, err = io.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -616,8 +617,6 @@ func soapRequestWithIP(ctx context.Context, url, service, function, message stri
|
|||||||
|
|
||||||
l.Debugf("SOAP Response: %s\n\n%s\n\n", r.Status, resp)
|
l.Debugf("SOAP Response: %s\n\n%s\n\n", r.Status, resp)
|
||||||
|
|
||||||
r.Body.Close()
|
|
||||||
|
|
||||||
if r.StatusCode >= 400 {
|
if r.StatusCode >= 400 {
|
||||||
return resp, errors.New(function + ": " + r.Status)
|
return resp, errors.New(function + ": " + r.Status)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user