Expand description
A flexible and ergonomic HTTP toolkit for Rust.
This crate provides high-level abstractions for HTTP operations while maintaining performance and type safety. It’s designed to be no-std compatible with optional standard library features.
§Features
- Type-safe HTTP primitives - Request, Response, Headers, and Body types with strong type checking
- Streaming support - Efficient handling of large payloads through streaming interfaces
- Body transformations - Convert between different body formats (JSON, form data, files) with zero-copy when possible
- Middleware system - Extensible middleware architecture for request/response processing
- Async/await ready - Built on top of
futures-litefor async I/O operations
§Optional Features
json- JSON serialization/deserialization via serde_json (enabled by default)form- Form data handling via serde_urlencoded (enabled by default)fs- File upload support with MIME type detectionmime- MIME type parsing and manipulationhttp_body- Implementation of http_body traitsstd- Enable standard library support (enabled by default)
Re-exports§
pub use error::BoxHttpError;pub use error::Error;pub use error::HttpError;pub use error::Result;pub use error::ResultExt;
Modules§
- endpoint
- HTTP endpoint abstraction for request handling.
- error
- Error types and utilities.
- header
- HTTP header types
- method
- The HTTP request method
- middleware
- Middleware functionality for HTTP request and response processing.
- sse
- Server-Sent Events (SSE) implementation module.
- uri
- URI component of request and response lines
- utils
- Utility types and functions for HTTP operations.
- version
- HTTP version
- ws
- WebSocket message and configuration types.
Macros§
- http_
error - Defines a zero-sized [
HttpError] type that renders as a static message. - http_
error_ fmt - Defines a zero-sized type that implements [
HttpError] with a custom formatter.
Structs§
- Body
- Flexible HTTP body that can represent data in various forms.
- Extensions
- A type map of protocol extensions.
- Method
- The Request Method (VERB)
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.). - Uri
- The URI component of a request.
- Version
- Represents a version of the HTTP spec.
Enums§
- Body
Error - Error type for body operations.
Traits§
- Endpoint
- A trait for types that can handle HTTP requests and generate responses.
- Middleware
- Trait for implementing middleware that can process HTTP requests and responses.