io.Discard is already handeld by Body.Close()

This commit is contained in:
Christoph Polcin 2023-06-08 15:26:30 +02:00 committed by Christoph Polcin
parent 11f0c10ed2
commit 036581a6c8

View File

@ -43,12 +43,10 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R
} }
if redo, err = auth.Verify(c.c, rs, path); err != nil { if redo, err = auth.Verify(c.c, rs, path); err != nil {
io.Copy(io.Discard, rs.Body)
rs.Body.Close() rs.Body.Close()
return nil, err return nil, err
} }
if redo { if redo {
io.Copy(io.Discard, rs.Body)
rs.Body.Close() rs.Body.Close()
if body, err = r.GetBody(); err != nil { if body, err = r.GetBody(); err != nil {
return nil, err return nil, err