move all configuration from Client to ClientBuilder

This commit is contained in:
Sean McArthur
2017-05-31 17:04:58 -07:00
parent f3df667e80
commit 8d784faa98
3 changed files with 101 additions and 68 deletions

View File

@@ -62,8 +62,7 @@ impl RedirectPolicy {
/// # use reqwest::{Error, RedirectPolicy};
/// #
/// # fn run() -> Result<(), Error> {
/// let mut client = reqwest::Client::new()?;
/// client.redirect(RedirectPolicy::custom(|attempt| {
/// let custom = RedirectPolicy::custom(|attempt| {
/// if attempt.previous().len() > 5 {
/// attempt.too_many_redirects()
/// } else if attempt.url().host_str() == Some("example.domain") {
@@ -72,7 +71,10 @@ impl RedirectPolicy {
/// } else {
/// attempt.follow()
/// }
/// }));
/// });
/// let client = reqwest::Client::builder()?
/// .redirect(custom)
/// .build()?;
/// # Ok(())
/// # }
/// ```