From d3f6960ba074bff5963c40fb6ff95cfe316d542b Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Sun, 5 May 2024 15:43:38 +0000 Subject: [PATCH] close + drain body if response body is too large (#2897) --- internal/httpclient/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index 74c931ea9..ba8760091 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -400,6 +400,7 @@ func (c *Client) do(r *Request) (rsp *http.Response, retry bool, err error) { // Check response body not too large. if rsp.ContentLength > c.bodyMax { + _ = rsp.Body.Close() return nil, false, ErrBodyTooLarge }