Repository navigation
breaking: use standard body conversions - #275
Merged
FalkWoldmann merged 1 commit intoSep 20, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
danieleades
marked this pull request as ready for review
August 9, 2026 20:05
danieleades
force-pushed
the
agent/simplify-body-conversions
branch
5 times, most recently
from
August 16, 2026 12:40
d193b7d to
60d0539
Compare
danieleades
force-pushed
the
agent/simplify-body-conversions
branch
from
August 17, 2026 18:50
60d0539 to
9741223
Compare
danieleades
force-pushed
the
agent/simplify-body-conversions
branch
from
September 20, 2026 14:09
755811b to
0e2e381
Compare
Member
|
Nit: Can you deduplictae the code in the from impls? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the body-conversion cleanup from #259, split out so it can be reviewed independently.
The private
IntoMockBytestrait models every body conversion as fallible, even though all of its implementations are infallible. This replaces it with the standardInto<HttpMockBytes>conversion and removes the dead error path.Owned
http::Requestandhttp::Responseconversions now move their bodies instead of borrowing and cloning them. That removes an unnecessaryClonebound, supports non-Clonebody types, and avoids copyingVec<u8>andStringbodies. Borrowed conversions remain available when the caller wants to retain the source.Excluding tests, changelog and documentation changes, this replaces roughly 80 production lines with 52: about 28 fewer lines overall.
One deliberate narrowing is that
Box<[u8]>bodies no longer convert directly. That support is niche, adds an orphan-rule API commitment, and is not used internally. Existing callers can map the body throughBytes::fromorVec::from; both take ownership of the same allocation, so this does not add a copy. Empty()bodies remain supported becauseRequest<()>andResponse<()>are conventional HTTP message types.Checks:
cargo testcargo test --all-features --libcargo clippy --all-targets --all-featurescargo fmt --all -- --check