fix: close Body correctly
This commit is contained in:
parent
02580cce20
commit
254effa8e5
2 changed files with 6 additions and 3 deletions
|
|
@ -47,6 +47,9 @@ func sendRequest(ctx context.Context, url string, body interface{}, headers http
|
|||
|
||||
status := resp.StatusCode
|
||||
if status < 200 || status >= 300 {
|
||||
defer func() {
|
||||
_ = resp.Body.Close()
|
||||
}()
|
||||
return nil, fmt.Errorf("request failed with status %d", status)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue