add note on how to get ResponseOptions

This commit is contained in:
Sam Judelson 2024-02-28 14:21:30 -05:00 committed by GitHub
parent 6a83161368
commit ef4c628994
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,6 +79,13 @@ impl ResponseParts {
}
/// Allows you to override details of the HTTP response like the status code and add Headers/Cookies.
/// ResponseOptions is stored in your server's context if you've called `.leptos_routes` on your router.
/// ```rust
/// #[server]
/// pub async fn get_opts() -> Result<(),ServerFnError> {
/// let opts = expect_context::<leptos_axum::ResponseOptions>();
/// Ok(())
/// }
#[derive(Debug, Clone, Default)]
pub struct ResponseOptions(pub Arc<RwLock<ResponseParts>>);