Expand description
OxiHTTP - Pure-Rust HTTP facade for the COOLJAPAN ecosystem.
This crate provides a unified API for HTTP client and server functionality,
re-exporting types from oxihttp-core, oxihttp-client, and oxihttp-server.
§Features
client(default): HTTP client with connection pooling, redirects, retries.server: HTTP server with routing, middleware, graceful shutdown.tls: TLS support via oxitls.
§Feature flags
| Feature | Enables | Default |
|---|---|---|
client | HTTP client (connection pooling, redirects, retries) | ✓ |
server | HTTP server (routing, middleware, graceful shutdown) | ✓ |
tls | HTTPS client + server TLS via rustls/oxitls | ✗ |
websocket | RFC 6455 WebSocket (server-side) | ✗ |
compression | Response compression via oxiarc-deflate | ✗ |
decompression | Client auto-decompression via oxiarc-deflate | ✗ |
static-files | ServeDir/ServeFile static file serving | ✗ |
sse | Server-Sent Events | ✗ |
tower | Tower middleware integration | ✗ |
socks | SOCKS5 proxy support | ✗ |
all | All of the above | ✗ |
§Quick Start
// Simple GET request
let client = oxihttp::Client::builder().build()?;
let resp = client.get("http://example.com")?.send().await?;
println!("Status: {}", resp.status());
let body = resp.body_text().await?;
println!("Body: {body}");Modules§
- migration
- reqwest → OxiHTTP Migration Guide
- prelude
- A prelude module re-exporting the most commonly used types.
- response
- Response helpers for the OxiHTTP server.
Structs§
- Body
Stream - An async stream of response body chunks produced by
Response::body_stream(). - Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- Bytes
Mut - A unique reference to a contiguous slice of memory.
- Client
- HTTP client with connection pooling, redirect handling, and retry support.
- Client
Builder - A builder for constructing a
Clientwith custom configuration. - Cookie
- Represents a single HTTP cookie.
- Cookie
Jar - A jar for collecting and managing cookies across requests and responses.
- Cors
Config - Configuration for Cross-Origin Resource Sharing (CORS).
- Form
Body - Builder for URL-encoded form bodies (
application/x-www-form-urlencoded). - Header
Map - A specialized multimap for header names and values.
- Header
Name - Represents an HTTP header field name
- Header
Value - Represents an HTTP header field value.
- Method
- The Request Method (VERB)
- Multipart
Builder - Builder for
multipart/form-databodies per RFC 7578. - Multipart
Part - A single MIME part in a multipart body.
- Rate
Limiter - Rate limiter using the token bucket algorithm.
- RawResponse
- Convenience re-export of
http::Response(the raw http crate type). Represents an HTTP response - Request
- Convenience re-export of
http::Request. Represents an HTTP request. - Request
Builder - Builder for a single HTTP request.
- Response
- HTTP response wrapper providing convenience methods for body consumption.
- Retry
Policy - Configuration for automatic request retries.
- Router
- HTTP request router with path-parameter extraction and method-based dispatch.
- Server
- An HTTP server that listens on a TCP socket and dispatches requests
through a
Routerwith optional middleware. - Server
Builder - Builder for configuring and starting an HTTP server.
- Server
Request - A request with parsed path parameters and query string.
- 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
- The body type for requests and responses in the OxiHTTP stack.
- Content
Type - Well-known content types for HTTP request and response bodies.
- OxiHttp
Error - Top-level error type for the OxiHTTP stack.
- Pinned
Body - A pinnable body type that implements
http_body::Body. - Redirect
Policy - Policy controlling how the client handles HTTP redirects.
- Same
Site - The SameSite cookie attribute.
Traits§
- Header
MapExt - Extension trait providing typed accessors for common HTTP headers.
- UriExt
- Extension trait providing convenience methods for
http::Uri.
Functions§
- delete
- One-shot DELETE request using a default client.
- get
- One-shot GET request using a default client.
- post
- One-shot POST request using a default client.
- put
- One-shot PUT request using a default client.
- version
- Return the crate version at runtime.