From e13952811d6882e9dfd2676fe7ae16a6d5896fde Mon Sep 17 00:00:00 2001 From: Roman Timushev Date: Wed, 17 May 2023 14:58:32 +0200 Subject: [PATCH] Preserve service error type in RequestDecompression --- tower-http/src/decompression/request/future.rs | 6 ++---- tower-http/src/decompression/request/service.rs | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) 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 {