From 328cc3d7d1f376759182a123764dd5f5a36ec654 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Fri, 26 Jul 2024 23:41:19 +0800 Subject: [PATCH] fix: close res body (#374) --- pkg/utils/httpreq/httpreq.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/utils/httpreq/httpreq.go b/pkg/utils/httpreq/httpreq.go index 017d50f..00638bb 100644 --- a/pkg/utils/httpreq/httpreq.go +++ b/pkg/utils/httpreq/httpreq.go @@ -24,6 +24,7 @@ func (c *Client) Get(url string, response interface{}) error { if err != nil { return fmt.Errorf("error creating request: %v", err) } + defer res.Body.Close() if err := jsoniter.NewDecoder(res.Body).Decode(&response); err != nil { return fmt.Errorf("error trying to unmarshal the response: %v", err) }