fix: close body before retrying

This commit is contained in:
stainless-app[bot] 2025-08-29 02:06:52 +00:00
parent a1074882ee
commit 4da3f7f372

View file

@ -464,6 +464,11 @@ func (cfg *RequestConfig) Execute() (err error) {
break
}
// Close the response body before retrying to prevent connection leaks
if res != nil && res.Body != nil {
res.Body.Close()
}
time.Sleep(retryDelay(res, retryCount))
}