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 rust-webx 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.

Request structs are bound by webx_core::route::binding::RequestModel, which #[derive(WebxRequestMeta)] implements.

§Helpers

Structs§

ByteRange
An inclusive byte range, as requested by a Range header.
FileBody
A file response — the rust-webx counterpart of ASP.NET Core’s File(...) / PhysicalFile(...) / Results.File(...).
HttpStatus
Common HTTP status codes.

Enums§

Disposition
How a file response should be presented.
FileSource
Where a file response’s bytes come from.
ResponseBody
The body of an HTTP response.

Constants§

STREAM_BUF_SIZE
Read/write buffer size used for streamed response bodies and spooled uploads.

Traits§

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.
SeekableReader
An async reader that can also seek.

Functions§

content_disposition_value
Build a Content-Disposition header value (RFC 6266).
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.