We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
base_url
1 parent 16a9ab9 commit c32ee64Copy full SHA for c32ee64
src/middleware/redirect/mod.rs
@@ -91,7 +91,7 @@ impl Middleware for Redirect {
91
// and try sending it until we get some status back that is not a
92
// redirect.
93
94
- let base_url = req.url().clone();
+ let mut base_url = req.url().clone();
95
96
while redirect_count < self.attempts {
97
redirect_count += 1;
@@ -101,7 +101,10 @@ impl Middleware for Redirect {
101
if let Some(location) = res.header(headers::LOCATION) {
102
let http_req: &mut http::Request = req.as_mut();
103
*http_req.url_mut() = match Url::parse(location.last().as_str()) {
104
- Ok(valid_url) => valid_url,
+ Ok(valid_url) => {
105
+ base_url = valid_url;
106
+ base_url.clone()
107
+ }
108
Err(e) => match e {
109
http::url::ParseError::RelativeUrlWithoutBase => {
110
base_url.join(location.last().as_str())?
0 commit comments