Skip to main content

RedirectPredicate

Trait RedirectPredicate 

Source
pub trait RedirectPredicate:
    Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn should_follow(
        &self,
        target: &Target,
        method: &Method,
        uri: &Uri,
        headers: &HeaderMap,
    ) -> bool;
}
Available on crate feature client only.
Expand description

Predicate used by FollowRedirect to decide whether a request should enter redirect following.

The predicate is checked before the initial request and before every follow-up redirect hop. If it returns false for the initial request, the layer directly passes the request to the inner service without cloning the request head for replay.

Required Methods§

Source

fn should_follow( &self, target: &Target, method: &Method, uri: &Uri, headers: &HeaderMap, ) -> bool

Return true if redirects should be followed for this request target and request head.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> RedirectPredicate for F
where F: Fn(&Target, &Method, &Uri, &HeaderMap) -> bool + Clone + Send + Sync + 'static,