From ef4c628994b8b18c9b6b762175c558ddf9465b20 Mon Sep 17 00:00:00 2001 From: Sam Judelson <64875465+sjud@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:21:30 -0500 Subject: [PATCH 1/2] add note on how to get ResponseOptions --- integrations/axum/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/integrations/axum/src/lib.rs b/integrations/axum/src/lib.rs index 42d69fdd01..3a888d5406 100644 --- a/integrations/axum/src/lib.rs +++ b/integrations/axum/src/lib.rs @@ -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::(); +/// Ok(()) +/// } #[derive(Debug, Clone, Default)] pub struct ResponseOptions(pub Arc>); From 7fd15031a02f1bde98d110b924051c4116ad2a89 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 1 Mar 2024 10:37:30 -0500 Subject: [PATCH 2/2] add some detail and format links --- integrations/axum/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/integrations/axum/src/lib.rs b/integrations/axum/src/lib.rs index 3a888d5406..57e69e186b 100644 --- a/integrations/axum/src/lib.rs +++ b/integrations/axum/src/lib.rs @@ -79,7 +79,14 @@ 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. +/// +/// `ResponseOptions` is provided via context when you use most of the handlers provided in this +/// crate, including [`.leptos_routes`](LeptosRoutes::leptos_routes), +/// [`.leptos_routes_with_context`](LeptosRoutes::leptos_routes_with_context), [`handle_server_fns`], etc. +/// You can find the full set of provided context types in each handler function. +/// +/// If you provide your own handler, you will need to provide `ResponseOptions` via context +/// yourself if you want to access it via context. /// ```rust /// #[server] /// pub async fn get_opts() -> Result<(),ServerFnError> {