From 0699394c218ec7fc2844e000bc716ed02159d428 Mon Sep 17 00:00:00 2001 From: shouya <526598+shouya@users.noreply.github.com> Date: Tue, 19 Mar 2024 21:03:07 +0900 Subject: [PATCH] Support conversion to http::Response --- src/async_impl/response.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/async_impl/response.rs b/src/async_impl/response.rs index a947b5151..1ee4a2f36 100644 --- a/src/async_impl/response.rs +++ b/src/async_impl/response.rs @@ -446,6 +446,16 @@ impl> From> for Response { } } +/// A `Response` can be converted into a `http::Response`. +// It's supposed to be the inverse of the conversion above. +impl From for http::Response { + fn from(r: Response) -> http::Response { + let (parts, body) = r.res.into_parts(); + let body = Body::streaming(body); + http::Response::from_parts(parts, body) + } +} + #[cfg(test)] mod tests { use super::Response;