Expand description
Built-in middleware. Each piece is an async function with the
signature async fn(Request, Next) -> Result<Response>. Drop any of
them into Router::middleware(...) in whatever order you want.
Structs§
- Correlation
Id - Wrapper carried in the request context so handlers can pull it
out via
req.ctx().get::<CorrelationId>(). The inner string is the UUID rendered in hyphenated lowercase form. - Csrf
Guard - A value a handler can pull out of the request context to embed in a rendered form. Lightweight; just wraps a string.
- Rate
Limiter
Constants§
- CORRELATION_
ID_ HEADER - Response + request header name. Lower-case to keep parity with the HTTP/2 wire format and to match what other observability tooling (OpenTelemetry, Cloudflare, etc.) writes.
- CSRF_
HEADER
Functions§
- correlation_
id - Middleware: attach a UUID v7 to every request, surface it in the response, and stash it in the request context for the audit pipeline to pick up.
- csrf_
protect - gzip
- logger
- rate_
limit - The middleware function. Wrap a limiter into a closure and hand
it to
Router::middleware(...). - security_
headers