diff --git a/src/response.rs b/src/response.rs index 3e7dcc5..a0fe15e 100644 --- a/src/response.rs +++ b/src/response.rs @@ -288,7 +288,7 @@ impl Response { /// assert_eq!(bytes.len(), len); /// # } /// ``` - pub fn into_reader(self) -> impl Read { + pub fn into_reader(self) -> impl Read + Send + Sync { // let is_http10 = self.http_version().eq_ignore_ascii_case("HTTP/1.0"); let is_close = self @@ -326,9 +326,8 @@ impl Response { let stream = DeadlineStream::new(stream, deadline); match (use_chunked, limit_bytes) { - (true, _) => { - Box::new(PoolReturnRead::new(unit, ChunkDecoder::new(stream))) as Box - } + (true, _) => Box::new(PoolReturnRead::new(unit, ChunkDecoder::new(stream))) + as Box, (false, Some(len)) => { Box::new(PoolReturnRead::new(unit, LimitedRead::new(stream, len))) } diff --git a/src/stream.rs b/src/stream.rs index 5c79547..ff0faee 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -32,7 +32,7 @@ pub enum Stream { Https(BufReader>), Cursor(Cursor>), #[cfg(test)] - Test(Box, Vec), + Test(Box, Vec), } // DeadlineStream wraps a stream such that read() will return an error