respect disable_redirects configuration

This commit is contained in:
Thiago Arrais 2020-12-04 13:59:52 -03:00
parent 05527b3e51
commit 0af013a972
1 changed files with 1 additions and 3 deletions

View File

@ -17,7 +17,6 @@ use crate::{Client, ClientConfig};
/// builder-like pattern. /// builder-like pattern.
pub struct ClientBuilder { pub struct ClientBuilder {
default_headers: bool, default_headers: bool,
allow_redirects: bool,
max_redirects: usize, max_redirects: usize,
max_http_version: Option<http::Version>, max_http_version: Option<http::Version>,
stream_window_size: Option<u32>, stream_window_size: Option<u32>,
@ -37,7 +36,6 @@ impl ClientBuilder {
pub fn new() -> Self { pub fn new() -> Self {
ClientBuilder { ClientBuilder {
default_headers: true, default_headers: true,
allow_redirects: true,
max_redirects: 10, max_redirects: 10,
headers: HeaderMap::new(), headers: HeaderMap::new(),
timeout: Some(Duration::from_secs(5)), timeout: Some(Duration::from_secs(5)),
@ -81,7 +79,7 @@ impl ClientBuilder {
/// ///
/// Redirects are allowed by default. /// Redirects are allowed by default.
pub fn disable_redirects(mut self) -> Self { pub fn disable_redirects(mut self) -> Self {
self.allow_redirects = false; self.max_redirects = 0;
self self
} }