[][src]Function reign_view::redirect

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

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()
}