Skip to content

Commit 7b8e03a

Browse files
committed
fix: ensure response body is closed after request
1 parent 1c69289 commit 7b8e03a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest/rest_client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ func (c *clientImpl) retry(endpoint *CompiledEndpoint, rqBody any, rsBody any, t
132132
_ = c.RateLimiter().Unlock(endpoint, nil)
133133
return fmt.Errorf("error doing request in rest client: %w", err)
134134
}
135+
defer func() {
136+
_ = rs.Body.Close()
137+
}()
135138

136139
if err = c.RateLimiter().Unlock(endpoint, rs); err != nil {
137140
return fmt.Errorf("error unlocking bucket in rest client: %w", err)

0 commit comments

Comments
 (0)