dont try to redirect if post body cannot be reset
This commit is contained in:
@@ -115,3 +115,10 @@ pub fn as_hyper_body<'a>(body: &'a mut Body) -> ::hyper::client::Body<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn can_reset(body: &Body) -> bool {
|
||||
match body.reader {
|
||||
Kind::Bytes(_) => true,
|
||||
Kind::Reader(..) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,13 @@ impl<'a> RequestBuilder<'a> {
|
||||
true
|
||||
},
|
||||
StatusCode::TemporaryRedirect |
|
||||
StatusCode::PermanentRedirect => true,
|
||||
StatusCode::PermanentRedirect => {
|
||||
if let Some(ref body) = body {
|
||||
body::can_reset(body)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
},
|
||||
_ => false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user