Function warp::redirect::temporary

source ·
pub fn temporary(uri: impl AsLocation) -> impl Reply
Expand description

HTTP 307 Temporary Redirect: Description: The requested resource can be found at a different URL temporarily. Usage: Similar to 302, but explicitly defined as a temporary redirect. The main difference between 307 and 302 is that 307 preserves the method of the original request when redirecting. If the original request was a POST, the subsequent request to the new URL will also be a POST. Common Use Case: Temporary redirects that should preserve the original request method.

This is similar to see_other but the HTTP method and the body of the request to the new location will be the same as the method and body of the current request.

§Example

use warp::{http::Uri, Filter};

let route = warp::path("v1")
    .map(|| {
        warp::redirect::temporary(Uri::from_static("/v2"))
    });