[][src]Function reign::prelude::redirect

pub fn redirect<L>(location: L) -> Result<Response<Body>, Error> where
    L: AsRef<str>, 

Sends a redirect for reign_router handler.

The response is sent with status code 303 and location header.

Examples

use reign::{
    view::redirect,
    router::{HandleFuture, Request, futures::FutureExt},
};

fn handler(req: &mut Request) -> HandleFuture {
    async move {
        Ok(redirect("/dashboard")?)
    }.boxed()
}