[bugfix] only set content-length AFTER rewinding body bytes (#2086)
This commit is contained in:
parent
3920bc87d1
commit
0ddc2edf19
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue