Enum treemux::RedirectBehavior[][src]

pub enum RedirectBehavior {
    Redirect301,
    Redirect307,
    Redirect308,
    UseHandler,
}

Sets the behavior when the router redirects the request to the canonical version of the requested URL using redirect_trailing_slash or redirect_clean. The default behavior is to return a 301 status, redirecting the browser to the version of the URL that matches the given pattern.

On a POST request, most browsers that receive a 301 will submit a GET request to the redirected URL, meaning that any data will likely be lost. If you want to handle and avoid this behavior, you may use TEMPORARY_REDIRECT (307), which causes most browsers to resubmit the request using the original method and request body.

Since 307 is supposed to be a temporary redirect, the new 308 status code has been proposed, which is treated the same, except it indicates correctly that the redirection is permanent. The big caveat here is that the RFC is relatively recent, and older browsers will not know what to do with it. Therefore its use is not recommended unless you really know what you're doing.

Variants

Redirect301
Redirect307
Redirect308
UseHandler

Trait Implementations

impl Clone for RedirectBehavior[src]

impl Copy for RedirectBehavior[src]

impl Debug for RedirectBehavior[src]

impl Display for RedirectBehavior[src]

impl Eq for RedirectBehavior[src]

impl PartialEq<RedirectBehavior> for RedirectBehavior[src]

impl StructuralEq for RedirectBehavior[src]

impl StructuralPartialEq for RedirectBehavior[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.