diff --git a/src/client/mod.rs b/src/client/mod.rs index 71b2046e8b..a64970fe99 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -562,6 +562,26 @@ where } } +impl tower_service::Service> for &'_ Client +where + C: Connect + Clone + Send + Sync + 'static, + B: HttpBody + Send + 'static, + B::Data: Send, + B::Error: Into>, +{ + type Response = Response; + type Error = crate::Error; + type Future = ResponseFuture; + + fn poll_ready(&mut self, _: &mut task::Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + + fn call(&mut self, req: Request) -> Self::Future { + self.request(req) + } +} + impl Clone for Client { fn clone(&self) -> Client { Client {