Skip to content

Commit

Permalink
fix: accidentally set content-length to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
zuisong committed Mar 26, 2024
1 parent 6768a8e commit 46b0094
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/async_impl/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,11 @@ impl HttpBody for Body {
fn size_hint(&self) -> http_body::SizeHint {
match self.inner {
Inner::Reusable(ref bytes) => {
let mut hint = http_body::SizeHint::default();
hint.set_exact(bytes.len() as u64);
hint
if bytes.is_empty() {
http_body::SizeHint::default()
} else {
http_body::SizeHint::with_exact(bytes.len() as u64)
}
}
Inner::Streaming(ref body) => body.size_hint(),
}
Expand Down

0 comments on commit 46b0094

Please sign in to comment.