Skip to content

Commit 71be542

Browse files
benfersealgesten
authored andcommitted
fix: Determine the URL to connect to after middleware finishes
Fixes: #741
1 parent fce56bb commit 71be542

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/request.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ impl Request {
115115
for h in &self.headers {
116116
h.validate()?;
117117
}
118-
let url = self.parse_url()?;
119118

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

139138
let request_fn = |req: Request| {
140139
let reader = payload.into_read();
140+
let url = req.parse_url()?;
141141
let unit = Unit::new(
142142
&req.agent,
143143
&req.method,
@@ -147,7 +147,7 @@ impl Request {
147147
deadline,
148148
);
149149

150-
unit::connect(unit, true, reader).map_err(|e| e.url(url.clone()))
150+
unit::connect(unit, true, reader).map_err(|e| e.url(url))
151151
};
152152

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

0 commit comments

Comments
 (0)