Skip to content

Commit d1022b3

Browse files
shouyaseanmonstar
authored andcommitted
Support conversion to http::Response
1 parent a29c7f9 commit d1022b3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/async_impl/response.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,16 @@ impl<T: Into<Body>> From<http::Response<T>> for Response {
446446
}
447447
}
448448

449+
/// A `Response` can be converted into a `http::Response`.
450+
// It's supposed to be the inverse of the conversion above.
451+
impl From<Response> for http::Response<Body> {
452+
fn from(r: Response) -> http::Response<Body> {
453+
let (parts, body) = r.res.into_parts();
454+
let body = Body::streaming(body);
455+
http::Response::from_parts(parts, body)
456+
}
457+
}
458+
449459
#[cfg(test)]
450460
mod tests {
451461
use super::Response;

0 commit comments

Comments
 (0)