The main reason we have Clone constraints on request-related types is because the HttpClient trait requires an immutable Request, but reqwest::Client wants a mutable request. The original intent - as found in the legacy branch - was that a client - the transport, really - shouldn't mutate the request. In concept that makes sense: only Policy implementations were intended to do that. However, this prevents us from effectively streaming request bodies without jumping through hooks like in #4491.
Should we ever cut a 2.0 release with breaking changes, we should reconsider making the Request mutable, as would be necessary to stream the request body. This should allow us to remove the Clone constraint and clean up a lot of code.
The main reason we have
Cloneconstraints on request-related types is because theHttpClienttrait requires an immutableRequest, butreqwest::Clientwants a mutable request. The original intent - as found in thelegacybranch - was that a client - the transport, really - shouldn't mutate the request. In concept that makes sense: onlyPolicyimplementations were intended to do that. However, this prevents us from effectively streaming request bodies without jumping through hooks like in #4491.Should we ever cut a 2.0 release with breaking changes, we should reconsider making the
Requestmutable, as would be necessary to stream the request body. This should allow us to remove theCloneconstraint and clean up a lot of code.