Skip to content

Commit 5c8f224

Browse files
committed
fix: accidentally set content-length to 0
1 parent 14e46ff commit 5c8f224

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/async_impl/body.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,17 @@ impl HttpBody for Body {
267267

268268
fn size_hint(&self) -> http_body::SizeHint {
269269
match self.inner {
270-
Inner::Reusable(ref bytes) => {
271-
let mut hint = http_body::SizeHint::default();
272-
hint.set_exact(bytes.len() as u64);
273-
hint
274-
}
270+
Inner::Reusable(ref bytes) => http_body::SizeHint::with_exact(bytes.len() as u64),
275271
Inner::Streaming(ref body) => body.size_hint(),
276272
}
277273
}
274+
275+
fn is_end_stream(&self) -> bool {
276+
match self.inner {
277+
Inner::Reusable(ref bytes) => bytes.is_empty(),
278+
Inner::Streaming(ref body) => body.is_end_stream(),
279+
}
280+
}
278281
}
279282

280283
// ===== impl TotalTimeoutBody =====

0 commit comments

Comments
 (0)