diff --git a/tower-http/CHANGELOG.md b/tower-http/CHANGELOG.md index 1c3b55d7..c56bc14f 100644 --- a/tower-http/CHANGELOG.md +++ b/tower-http/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed - Bump Minimum Supported Rust Version to 1.66 ([#433]) +- Preserve service error type in RequestDecompression ([#368]) ## Removed @@ -26,6 +27,7 @@ http-range-header to `0.4` [#418]: https://github.com/tower-rs/tower-http/pull/418 [#433]: https://github.com/tower-rs/tower-http/pull/433 +[#368]: https://github.com/tower-rs/tower-http/pull/368 # 0.4.2 (July 19, 2023) diff --git a/tower-http/src/decompression/request/future.rs b/tower-http/src/decompression/request/future.rs index ce3b04ad..ca6dcfa7 100644 --- a/tower-http/src/decompression/request/future.rs +++ b/tower-http/src/decompression/request/future.rs @@ -67,16 +67,14 @@ where B: Body + Send + 'static, B::Data: Buf + 'static, B::Error: Into + 'static, - E: Into, { - type Output = Result>, BoxError>; + type Output = Result>, E>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { match self.project().kind.project() { StateProj::Inner { fut } => fut .poll(cx) - .map_ok(|res| res.map(|body| body.map_err(Into::into).boxed_unsync())) - .map_err(Into::into), + .map_ok(|res| res.map(|body| body.map_err(Into::into).boxed_unsync())), StateProj::Unsupported { accept } => { let res = Response::builder() .header( diff --git a/tower-http/src/decompression/request/service.rs b/tower-http/src/decompression/request/service.rs index 6d507366..443f73a9 100644 --- a/tower-http/src/decompression/request/service.rs +++ b/tower-http/src/decompression/request/service.rs @@ -42,16 +42,15 @@ where S: Service>, Response = Response>, ReqBody: Body, ResBody: Body + Send + 'static, - S::Error: Into, ::Error: Into, D: Buf + 'static, { type Response = Response>; - type Error = BoxError; + type Error = S::Error; type Future = ResponseFuture; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { - self.inner.poll_ready(cx).map_err(Into::into) + self.inner.poll_ready(cx) } fn call(&mut self, req: Request) -> Self::Future {