Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ pub use url::ParseError as UrlError;
pub use self::client::{Certificate, Client, ClientBuilder};
pub use self::error::{Error, Result};
pub use self::body::Body;
pub use self::redirect::RedirectPolicy;
pub use self::redirect::{RedirectAction, RedirectAttempt, RedirectPolicy};
pub use self::request::{Request, RequestBuilder};
pub use self::response::Response;

8 changes: 6 additions & 2 deletions src/redirect.rs
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ pub struct RedirectPolicy {
inner: Policy,
}

/// A type that holds information on the next request and previous requests
/// in redirect chain.
#[derive(Debug)]
pub struct RedirectAttempt<'a> {
next: &'a Url,
@@ -51,10 +53,10 @@ impl RedirectPolicy {
/// The custom policy should have some way of handling those.
///
/// Information on the next request and previous requests can be found
/// on the `RedirectAttempt` argument passed to the closure.
/// on the [`RedirectAttempt`] argument passed to the closure.
///
/// Actions can be conveniently created from methods on the
/// `RedirectAttempt`.
/// [`RedirectAttempt`].
///
/// # Example
///
@@ -78,6 +80,8 @@ impl RedirectPolicy {
/// # Ok(())
/// # }
/// ```
///
/// [`RedirectAttempt`]: struct.RedirectAttempt.html
pub fn custom<T>(policy: T) -> RedirectPolicy
where
T: Fn(RedirectAttempt) -> RedirectAction + Send + Sync + 'static,

0 comments on commit 8297979

Please sign in to comment.