[bugfix] only set content-length AFTER rewinding body bytes (#2086)

This commit is contained in:
kim 2023-08-08 12:45:29 +01:00 committed by GitHub
parent 3920bc87d1
commit 0ddc2edf19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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. // Rewind body reader and content-length if set.
if rc, ok := r.Body.(*byteutil.ReadNopCloser); ok { if rc, ok := r.Body.(*byteutil.ReadNopCloser); ok {
rc.Rewind() // set len AFTER rewind
r.ContentLength = int64(rc.Len()) r.ContentLength = int64(rc.Len())
rc.Rewind()
} }
// Sign the outgoing request. // Sign the outgoing request.