diff --git a/client.go b/client.go index 41bd53f..b3168df 100644 --- a/client.go +++ b/client.go @@ -147,12 +147,10 @@ func (dc *DecortClient) do(req *http.Request) (*http.Response, error) { req.Close = true if err != nil || resp == nil { if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) { - resp.Body.Close() for i := uint64(0); i < dc.cfg.Retries; i++ { time.Sleep(5 * time.Second) resp, err = dc.client.Do(req) if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) { - resp.Body.Close() continue } else if err == nil { break diff --git a/legacy-client.go b/legacy-client.go index 1e49c76..83203cd 100644 --- a/legacy-client.go +++ b/legacy-client.go @@ -148,12 +148,10 @@ func (ldc *LegacyDecortClient) do(req *http.Request) (*http.Response, error) { req.Close = true if err != nil || resp == nil { if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) { - resp.Body.Close() for i := uint64(0); i < ldc.cfg.Retries; i++ { time.Sleep(5 * time.Second) resp, err = ldc.client.Do(req) if strings.Contains(err.Error(), "connection reset by peer") || errors.Is(err, io.EOF) { - resp.Body.Close() continue } else if err == nil { break