glimr/response/redirect
Redirect Helpers
Builder pattern for creating HTTP redirects with support for flash messages and returning to previous pages. Use the builder to construct redirects before sending.
Values
pub fn back(
req: request.Request(wisp.Connection),
) -> response.Response(wisp.Body)
Sets the redirect path to the previous page from the Referer header. Panics if no referer is found. Useful for cancel or back buttons that must have a referrer.
Example:
redirect.back(req.request)
pub fn permanent(path: String) -> response.Response(wisp.Body)
Sends a permanent redirect (HTTP 308) to the specified path. Browsers will cache this redirect and automatically use the new location for all subsequent requests to the original URL.
Example:
redirect.permanent("/dashboard")
pub fn to(path: String) -> response.Response(wisp.Body)
Sends a temporary redirect (HTTP 303 See Other) to the specified path. The location header directs the browser to the new URL for this request only.
Example:
redirect.to("/dashboard")