Skip to content

Commit

Permalink
Fix comments on reqwest-response example for axum 0.7 (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardcl authored Dec 18, 2023
1 parent 2f585ac commit fd3bfe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/reqwest-response/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn proxy_via_reqwest(State(client): State<Client>) -> Response {

let response_builder = Response::builder().status(reqwest_response.status().as_u16());

// here the mapping of headers is required due to reqwest and axum differ on http crate versions
// Here the mapping of headers is required due to reqwest and axum differ on the http crate versions
let mut headers = HeaderMap::with_capacity(reqwest_response.headers().len());
headers.extend(reqwest_response.headers().into_iter().map(|(name, value)| {
let name = HeaderName::from_bytes(name.as_ref()).unwrap();
Expand All @@ -72,7 +72,7 @@ async fn proxy_via_reqwest(State(client): State<Client>) -> Response {

response_builder
.body(Body::from_stream(reqwest_response.bytes_stream()))
// Same goes for this unwrap
// This unwrap is fine because the body is empty here
.unwrap()
}

Expand Down

0 comments on commit fd3bfe4

Please sign in to comment.