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 authored and seanmonstar committed Mar 20, 2024
1 parent a29c7f9 commit d1022b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ impl<T: Into<Body>> From<http::Response<T>> for Response {
}
}

/// A `Response` can be converted into a `http::Response`.
// It's supposed to be the inverse of the conversion above.
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 d1022b3

Please sign in to comment.