Skip to content

Reintroduce SharedBody type and ensure that wrapped bodies have an accurate size hint#84

Merged
Pagten merged 2 commits into
masterfrom
pieagt/reintroduce-shared-body
Jun 23, 2026
Merged

Reintroduce SharedBody type and ensure that wrapped bodies have an accurate size hint#84
Pagten merged 2 commits into
masterfrom
pieagt/reintroduce-shared-body

Conversation

@Pagten

@Pagten Pagten commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR has two changes:

  • It re-introduces the SharedBody, which can be more convenient to work with than RequestBody in certain circumstances because it exposes a len() method and it implements AsRef<[u8]> and Clone.
  • Fixes an issue where wrapped bodies would not have an accurate size hint. Unfortunately this fix does limit the kinds of bodies we can wrap. Specifically, we now only support wrapping bodies with Bytes as their Data associated type.

@Pagten Pagten requested a review from heilhead June 23, 2026 09:40
Comment thread simple-hyper-client/src/body/mod.rs
heilhead
heilhead previously approved these changes Jun 23, 2026

@heilhead heilhead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Comment thread simple-hyper-client/src/body/shared.rs Outdated
Comment thread simple-hyper-client/src/body/mod.rs Outdated
@Pagten Pagten force-pushed the pieagt/reintroduce-shared-body branch from f72be87 to b9a0d12 Compare June 23, 2026 13:50
@Pagten Pagten requested a review from heilhead June 23, 2026 13:52
@Pagten Pagten merged commit cd423fa into master Jun 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants