From a6d0bc806c8b6c8d668e4c98a993beee2e8735fe Mon Sep 17 00:00:00 2001 From: Daming Yang Date: Mon, 4 Dec 2023 20:15:13 +0800 Subject: [PATCH] fix: res.Body must close --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index 3ebb5e86..afd0b1b4 100644 --- a/client.go +++ b/client.go @@ -1203,6 +1203,9 @@ func (c *Client) startupHealthcheck(parentCtx context.Context, timeout time.Dura defer cancel() req = req.WithContext(ctx) res, err := c.c.Do(req) + if res != nil && res.Body != nil { + res.Body.Close() + } if err != nil { lastErr = err } else if res.StatusCode >= 200 && res.StatusCode < 300 {