Skip to main content

Module http

Module http 

Source
Expand description

HTTP abstraction traits: IHttpContext, IHttpRequest, IHttpResponse.

This module defines the core interfaces for HTTP request/response handling in the LRWF framework. All types are defined as traits to enable testability and middleware composition.

§Traits

  • IHttpContext — The central context for a single HTTP request, providing access to request, response, and authentication claims.
  • IHttpRequest — Read-only access to the incoming HTTP request.
  • IHttpResponse — Mutable access to the outgoing HTTP response.
  • IClaimsExt — Extension for storing/retrieving authentication claims.
  • FromHttpContext — Build a request struct from HTTP request data.

§Helpers

Structs§

HttpStatus
Common HTTP status codes.

Traits§

FromHttpContext
Trait for constructing a request struct from the HTTP context.
IClaimsExt
Extension trait that adds claims storage to an IHttpContext.
IHttpContext
HTTP context encapsulating the request, response, and service provider for the duration of a single HTTP request.
IHttpRequest
HTTP request abstraction.
IHttpResponse
HTTP response abstraction.

Functions§

read_json_body
Helper: read JSON from the request body.
write_json_response
Helper: build a JSON response by serializing a value and writing it.

Type Aliases§

Json
Type alias for JSON responses in controller methods.