Avoid modifying original request in RoundTrip. (#805)
Avoid modifying original request in RoundTrip. (#805)

Avoid modifying the original request as per http.RoundTripper contract.
In UnauthenticatedRateLimitedTransport.RoundTrip, we need to modify the
URL of the request only, while in BasicAuthTransport.RoundTrip, we need
to modify only the headers.

We get rid of cloneRequest helper, which wasn't working well for the needs
of UnauthenticatedRateLimitedTransport.RoundTrip. Instead, now we have
the implementation of cloneRequest inlined in both RoundTrip methods.

We decided to make the cloneRequest implementation inlined because its used
at only these two places, and we think we won't gain much by making a
generic implementation of cloneRequest as a function. For more information,
see issue #556.

Fixes #556.
google/go-github