Skip to main content

Module http

Module http 

Source
Expand description

Framework-agnostic HTTP foundation: request, response, routing, middleware, kernel.

Modules§

actix
Actix-web bridge.
axum
Axum bridge.
client
Outbound HTTP client contract.

Structs§

AsyncFn
Function-style async controller.
AsyncHealthMiddleware
Async variant of HealthMiddleware.
AsyncHttpKernel
Runs async middleware, then the controller, and maps errors to responses.
AsyncNext
Remainder of the async middleware / controller stack.
AsyncRequestIdMiddleware
Async variant of RequestIdMiddleware.
AttributeBag
Heterogeneous map keyed by string. Values must be Send + Sync.
DefaultExceptionHandler
Maps HttpError::status_code and HttpError::message to a text response.
Headers
Header names stored in lowercase; lookup is case-insensitive.
HealthMiddleware
Short-circuits HEALTHZ_PATH / READYZ_PATH before the rest of the pipeline.
HttpCacheHeaders
Cache-related headers to apply on a Response.
HttpKernel
Runs middleware, then the controller, and maps errors to responses.
MatchResult
Successful match: route name plus path parameters.
Readiness
Shared readiness bit flipped false before HTTP drain / process exit.
Request
Framework-agnostic HTTP request.
RequestIdMiddleware
Ensures a request id exists on the request (header + attribute) and echoes it on the response.
Response
Framework-agnostic HTTP response.
Route
A single route: name, path pattern, and allowed methods.
RouteCollection
Ordered list of routes. First match wins.
SyncToAsync
Wraps a sync RequestHandler for use with crate::AsyncHttpKernel.
UrlMatcher
Matches request method and path against a RouteCollection.

Enums§

HttpError
Failure while handling a request.
Method
HTTP method on crate::Request.

Constants§

HEALTHZ_PATH
Default liveness probe path.
READYZ_PATH
Default readiness probe path.
REQUEST_ID_ATTRIBUTE
Request attribute key storing the resolved request id (String).
REQUEST_ID_HEADER
Default inbound/outbound header for correlation ids.
ROUTE_ATTRIBUTE
Attribute key written by UrlMatcher::apply for the matched route name.

Traits§

AsyncMiddleware
Layer that may inspect or mutate the request, then await AsyncNext::run.
AsyncRequestHandler
Async controller: turns a request into a response.
ExceptionHandler
Hook invoked when a handler or middleware returns HttpError.
Middleware
Layer that may inspect or mutate the request, then call next.
RequestHandler
Turns a request into a response or an error for the exception mapper.
RouteLoader
Loads routes into a RouteCollection.

Functions§

box_future
Helper to box an async block as BoxFuture.
ensure_request_id
Resolves or creates a request id, stores it on the request, and returns a clone.
etag
Strong ETag: "tag" (quotes added when missing).
healthz
Liveness response (200 + ok).
load_routes
Runs every loader in order into a fresh collection.
maybe_not_modified
Returns a 304 Not Modified when request is a conditional GET/HEAD that matches validators on response; otherwise returns response unchanged.
readyz
Readiness response: 200 + ready, or 503 + not ready.
request_id
Returns the request id from attributes when present.
weak_etag
Weak ETag: W/"tag".

Type Aliases§

BoxFuture
Owned future returned by AsyncRequestHandler::handle.