Why shouldn't RoundTrip modify the request ?
https://golang.org/src/net/http/client.go#L103
What happens if http.Request gets modified by a RoundTripper (http.Transport for instance)?
Why shouldn't RoundTrip modify the request ?
https://golang.org/src/net/http/client.go#L103
What happens if http.Request gets modified by a RoundTripper (http.Transport for instance)?
The awnser is stated in the interface comment https://golang.org/src/net/http/client.go#L89
A RoundTripper must be safe for concurrent use by multiple goroutines.
If a server gets a request, and starts multiple goroutines, it must be ensured that all requests work on the same input. If a RoundTripper changes the request, it can make already collected data useless (which may not even be noticed)