feat: add support for server-only extractors (#5086)

This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-12-11 18:21:27 -08:00
1 parent 552b553a44
commit 2da01937c1
2 files changed
+37 -3

No files matched your search

+7 -2
View File
@@ -282,7 +282,12 @@ async fn anonymous() -> Result<String> {
/// This is less preferred over the `#[get]`/`#[post]` syntax but is still functional for backwards
/// compatibility. Previously, only the `#[server]` attribute was available, but as of Dioxus 0.7,
/// the `#[get]`/`#[post]` attributes are preferred for new code.
#[server(prefix = "/api/custom", endpoint = "my_anonymous")]
///
/// You can also use server-only extractors here as well, provided they come after the configuration.
#[server(prefix = "/api/custom", endpoint = "my_anonymous", headers: dioxus_fullstack::HeaderMap)]
async fn custom_anonymous() -> Result<String> {
Ok("Hello from a custom anonymous server function!".to_string())
Ok(format!(
"Hello from a custom anonymous server function! -> {:#?}",
headers
))
}