From c42caf78a293e9dada8d53599ccd9942d234f8e5 Mon Sep 17 00:00:00 2001 From: Ringo Hoffmann Date: Fri, 28 Jan 2022 17:19:52 +0100 Subject: [PATCH] update doucmentaiton comment --- requests.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requests.go b/requests.go index 1fc00ac..0e68867 100644 --- a/requests.go +++ b/requests.go @@ -14,6 +14,11 @@ func (c *Client) req(method, path string, body io.Reader, intercept func(*http.R var retryBuf io.Reader if body != nil { + // Because Request#Do closes closable streams, Seeker#Seek + // will fail on retry because stream is already closed. + // This inhibits the closing of the passed stream on passing + // it to the RoundTripper and closes the stream after we + // are done with the body content. if cl, ok := body.(io.Closer); ok { body = closeInhibitor{body} defer cl.Close()