Azure / Azure/azure-sdk-for-rust
Make Request mutable for HttpClient
- Dominant language
- Rust
- Stars
- 884
- Forks
- 365
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 109
Description
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.
Contributor guide
Research direction
Start by reviewing the legacy branch behavior and issue #4491, which are the references provided for the current request-mutation and streaming constraints. The work would need a decided 2.0 API direction, including whether Request becomes mutable and how the Clone constraints are removed; this issue does not identify files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100