Skip to content

Commit

Permalink
Create a http::Response<hyper::Body> from a reqwest::Response
Browse files Browse the repository at this point in the history
  • Loading branch information
Threated committed Oct 11, 2023
1 parent 5df3861 commit 687fdfc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/async_impl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ impl From<Response> for Body {
}
}

/// A `Response` can be transformed into a classic http hyper body response.
impl From<Response> for http::Response<hyper::Body> {
fn from(r: Response) -> http::Response<hyper::Body> {
let (parts, body) = r.res.into_parts();
http::Response::from_parts(parts, hyper::Body::wrap_stream(body))
}
}

#[cfg(test)]
mod tests {
use super::Response;
Expand Down

0 comments on commit 687fdfc

Please sign in to comment.