Extracting Request Data
UseFullstackContext::extract() to extract Axum types inside server functions:
FullstackContext
TheFullstackContext provides access to the current HTTP request context on the server.
packages/fullstack-core/src/streaming.rs:17
Methods
current()
FullstackContext if available. Returns None on the client or outside a request context.
Location: packages/fullstack-core/src/streaming.rs:156
Example:
extract()
packages/fullstack-core/src/streaming.rs:128
Example:
extension()
packages/fullstack-core/src/streaming.rs:119
Example:
parts_mut()
packages/fullstack-core/src/streaming.rs:106
Example:
add_response_header()
packages/fullstack-core/src/streaming.rs:196
Example:
commit_http_status()
packages/fullstack-core/src/streaming.rs:216
Example:
Common Extractors
TypedHeader
Extract typed headers using theheaders crate:
Authorization<Bearer>- Authorization: Bearer tokenContentType- Content-Type headerUserAgent- User-Agent stringCookie- HTTP cookiesHost- Host headerReferer- Referer header
Extension
Extract shared state added via Axum extensions:Query
Extract query parameters from the URL:packages/fullstack/src/payloads/query.rs:12
The Query extractor uses serde_qs to support complex query structures.
Form and Multipart
Extract form data:Cookies
Extract cookies from the request:JSON Body
Extract and deserialize JSON from the request body:Custom Extractors
You can create custom extractors by implementingFromRequest: