Skip to content

Commit 8b0cafa

Browse files
committed
decompression: propagate size_hint when body is identity
1 parent 78e95d3 commit 8b0cafa

File tree

1 file changed

+8
-1
lines changed
  • tower-http/src/decompression

1 file changed

+8
-1
lines changed

tower-http/src/decompression/body.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use async_compression::tokio::bufread::ZlibDecoder;
1515
use async_compression::tokio::bufread::ZstdDecoder;
1616
use bytes::{Buf, Bytes};
1717
use http::HeaderMap;
18-
use http_body::Body;
18+
use http_body::{Body, SizeHint};
1919
use pin_project_lite::pin_project;
2020
use std::task::Context;
2121
use std::{
@@ -326,6 +326,13 @@ where
326326
BodyInnerProj::Zstd { inner } => match inner.0 {},
327327
}
328328
}
329+
330+
fn size_hint(&self) -> SizeHint {
331+
match self.inner {
332+
BodyInner::Identity { ref inner } => inner.size_hint(),
333+
_ => SizeHint::default(),
334+
}
335+
}
329336
}
330337

331338
#[cfg(feature = "decompression-gzip")]

0 commit comments

Comments
 (0)