|
|
|
|
|
by fishywang
389 days ago
|
|
The request body on the client do a lot of other things than reading the body once (an io.Reader can only be read once). There's Content-Length, and there's also the need to read it multiple times in case a redirect happens (so the same body need to be sent again when being redirected). As a result, the implementation in stdlib would check a few common io.Reader implementations (bytes.Buffer, bytes.Reader, strings.Reader) and make sure it stores something that can be read multiple times (if it's none of the 3, it's read fully into memory and stored instead). |
|