From 0ddc2edf199c146947423311e68fe109b95388bb Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:45:29 +0100 Subject: [PATCH] [bugfix] only set content-length AFTER rewinding body bytes (#2086) --- internal/httpclient/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index ffaf76537..fd70cca7e 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -247,8 +247,8 @@ func (c *Client) DoSigned(r *http.Request, sign SignFunc) (rsp *http.Response, e // Rewind body reader and content-length if set. if rc, ok := r.Body.(*byteutil.ReadNopCloser); ok { + rc.Rewind() // set len AFTER rewind r.ContentLength = int64(rc.Len()) - rc.Rewind() } // Sign the outgoing request.