Skip to main content

rumtk_web_render_redirect

Macro rumtk_web_render_redirect 

Source
macro_rules! rumtk_web_render_redirect {
    ( $url:expr ) => { ... };
}
Expand description

Generate redirect response automatically instead of actually rendering an HTML page.

§Examples

§Temporary Redirect

use rumtk_web::RUMStringConversions;
use rumtk_web::utils::response::RUMWebRedirect;
use rumtk_web::rumtk_web_render_redirect;

let url = "http://localhost/redirected";
let redirect = rumtk_web_render_redirect!(RUMWebRedirect::RedirectTemporary(url.to_rumstring()));

let result = redirect.expect("Failed to create the redirect response!").get_url();

assert_eq!(result, url, "Url in Response object does not match the expected!");