diff --git a/integrations/actix/src/lib.rs b/integrations/actix/src/lib.rs index cd4e12ef2..7aaf0ade7 100644 --- a/integrations/actix/src/lib.rs +++ b/integrations/actix/src/lib.rs @@ -6,7 +6,7 @@ //! [`examples`](https://github.com/leptos-rs/leptos/tree/main/examples) //! directory in the Leptos repository. -use actix_http::header::{HeaderName, HeaderValue}; +use actix_http::header::{HeaderName, HeaderValue, ACCEPT}; use actix_web::{ body::BoxBody, dev::{ServiceFactory, ServiceRequest}, @@ -25,7 +25,7 @@ use leptos_meta::*; use leptos_router::*; use parking_lot::RwLock; use regex::Regex; -use server_fn::request::actix::ActixRequest; +use server_fn::{redirect::REDIRECT_HEADER, request::actix::ActixRequest}; use std::{ fmt::{Debug, Display}, future::Future, @@ -99,11 +99,57 @@ impl ResponseOptions { } } -/// Provides an easy way to redirect the user from within a server function. Mimicking the Remix `redirect()`, -/// it sets a [StatusCode] of 302 and a [LOCATION](header::LOCATION) header with the provided value. -/// If looking to redirect from the client, `leptos_router::use_navigate()` should be used instead. +/// Provides an easy way to redirect the user from within a server function. +/// +/// This sets the `Location` header to the URL given. +/// +/// If the route or server function in which this is called is being accessed +/// by an ordinary `GET` request or an HTML `