Skip to content

Commit

Permalink
Fixed a bug from the hyper upgrade
Browse files Browse the repository at this point in the history
- We were using hyper Response::new to just copy the body when we should've been using Response::from_parts which keeps the headers and status when converting from Incoming to BoxBody
  • Loading branch information
tkmcmaster committed Aug 12, 2024
1 parent b1ff1dc commit db9d796
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/request/request_maker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl RequestMaker {
headers.insert(CONTENT_LENGTH, content_length.into());
}
debug!("final headers={:?}", headers);
info!("RequestMaker method=\"{}\" url=\"{}\" request_headers={:?} tags={:?}", method, url.as_str(), headers, tags);
info!("RequestMaker::send_request method=\"{}\" url=\"{}\" request_headers={:?} tags={:?}", method, url.as_str(), headers, tags);
let mut request_provider = json::json!({});
let request_obj = request_provider
.as_object_mut()
Expand Down Expand Up @@ -318,8 +318,12 @@ impl RequestMaker {
stats_tx,
tags,
};
debug!("RequestMaker::send_request Response<Incoming>={:?}", response);
// Convert from a Response<Incoming> to a Response<BoxBody> to pass to handle()
rh.handle(hyper::Response::new(response.into_body().boxed().map_err(std::io::Error::other).boxed()), auto_returns)
let (head, body) = response.into_parts();
let response = hyper::Response::from_parts(head, body.boxed().map_err(std::io::Error::other).boxed());
debug!("RequestMaker::send_request Response<BoxBody>={:?}", response);
rh.handle(response, auto_returns)
.map_err(TestError::from)
})
.or_else(move |r| {
Expand Down

0 comments on commit db9d796

Please sign in to comment.