Skip to content

Commit

Permalink
Support conversion to http::Response
Browse files Browse the repository at this point in the history
  • Loading branch information
shouya committed Mar 19, 2024
1 parent 3d3526b commit a4a971f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,15 @@ impl<T: Into<Body>> From<http::Response<T>> for Response {
}
}

/// A `Response` can be converted into a `http::Response`.
impl From<Response> for http::Response<Body> {
fn from(r: Response) -> http::Response<Body> {
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;
Expand Down

0 comments on commit a4a971f

Please sign in to comment.