FromRequestParts and can be freely combined with other extractors.
Request
Extract the entire request, consuming it:http::Request<Body>
The entire HTTP request.
Method
Extract the HTTP method:http::Method
The HTTP method (GET, POST, PUT, DELETE, etc.).
Uri
Extract the request URI:http::Uri
The request URI, including path and query string.
HeaderMap
Extract all request headers:http::HeaderMap
A map of all HTTP headers. The headers are cloned from the request.
Prefer using
TypedHeader from axum-extra to extract only the headers you need with type safety.Version
Extract the HTTP version:http::Version
The HTTP version (HTTP/1.1, HTTP/2, HTTP/3, etc.).
Extension
Extract typed values from request extensions:Extension<T>
A typed value stored in request extensions. Returns
500 Internal Server Error if the extension is not found.Optional extensions
UseOption<Extension<T>> to make the extension optional:
Adding extensions
Extensions are typically added by middleware:Parts
Extract the entire request parts (everything except the body):http::request::Parts
All parts of the request except the body. The parts are cloned.
Extensions
Extract the raw extensions map:http::Extensions
The raw type map of request extensions. The extensions are cloned.
Body extractors
These extractors consume the request body:String
String
The entire request body as a UTF-8 string. Returns
400 Bad Request if the body is not valid UTF-8.Bytes
bytes::Bytes
The entire request body as raw bytes.
Body
axum::body::Body
The raw request body as a stream.