Refactor Redirect API (#741)

Changed the redirect types to be from the `redirect` module:

- `reqwest::RedirectPolicy` is now `reqwest::redirect::Policy`
- `reqwest::RedirectAttempt` is now `reqwest::redirect::Attempt`
- `reqwest::RedirectAction` is now `reqwest::redirect::Action`

Changed behavior of default policy to no longer check for redirect loops
(loops should still be caught eventually by the maximum limit).

Removed the `too_many_redirects` and `loop_detected` methods from
`Action`.

Added `error` to `Action` that can be passed any error type.

Closes #717
This commit is contained in:
Sean McArthur
2019-12-16 15:57:09 -08:00
committed by GitHub
parent 382f1c0e6a
commit ce43f80d8b
7 changed files with 123 additions and 144 deletions

View File

@@ -173,7 +173,7 @@ async fn cookie_store_expires() {
}
});
let client = reqwest::r#async::Client::builder()
let client = reqwest::Client::builder()
.cookie_store(true)
.build()
.unwrap();
@@ -201,7 +201,7 @@ async fn cookie_store_path() {
}
});
let client = reqwest::r#async::Client::builder()
let client = reqwest::Client::builder()
.cookie_store(true)
.build()
.unwrap();

View File

@@ -240,7 +240,7 @@ async fn test_redirect_policy_can_stop_redirects_without_an_error() {
let url = format!("http://{}/no-redirect", server.addr());
let res = reqwest::Client::builder()
.redirect(reqwest::RedirectPolicy::none())
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap()
.get(&url)