Skip to content

Commit

Permalink
fix: Determine the URL to connect to after middleware finishes
Browse files Browse the repository at this point in the history
Fixes: #741
  • Loading branch information
benferse authored and algesten committed Apr 3, 2024
1 parent fce56bb commit 71be542
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl Request {
for h in &self.headers {
h.validate()?;
}
let url = self.parse_url()?;

#[cfg(any(feature = "gzip", feature = "brotli"))]
self.add_accept_encoding();
Expand All @@ -138,6 +137,7 @@ impl Request {

let request_fn = |req: Request| {
let reader = payload.into_read();
let url = req.parse_url()?;
let unit = Unit::new(
&req.agent,
&req.method,
Expand All @@ -147,7 +147,7 @@ impl Request {
deadline,
);

unit::connect(unit, true, reader).map_err(|e| e.url(url.clone()))
unit::connect(unit, true, reader).map_err(|e| e.url(url))
};

let response = if !self.agent.state.middleware.is_empty() {
Expand Down

0 comments on commit 71be542

Please sign in to comment.