Skip to main content

Crate oxihttp

Crate oxihttp 

Source
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

FeatureEnablesDefault
clientHTTP client (connection pooling, redirects, retries)
serverHTTP server (routing, middleware, graceful shutdown)
tlsHTTPS client + server TLS via rustls/oxitls
websocketRFC 6455 WebSocket (server-side)
compressionResponse compression via oxiarc-deflate
decompressionClient auto-decompression via oxiarc-deflate
static-filesServeDir/ServeFile static file serving
sseServer-Sent Events
towerTower middleware integration
socksSOCKS5 proxy support
allAll 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§

BodyStream
An async stream of response body chunks produced by Response::body_stream().
Bytes
A cheaply cloneable and sliceable chunk of contiguous memory.
BytesMut
A unique reference to a contiguous slice of memory.
Client
HTTP client with connection pooling, redirect handling, and retry support.
ClientBuilder
A builder for constructing a Client with custom configuration.
Cookie
Represents a single HTTP cookie.
CookieJar
A jar for collecting and managing cookies across requests and responses.
CorsConfig
Configuration for Cross-Origin Resource Sharing (CORS).
FormBody
Builder for URL-encoded form bodies (application/x-www-form-urlencoded).
HeaderMap
A specialized multimap for header names and values.
HeaderName
Represents an HTTP header field name
HeaderValue
Represents an HTTP header field value.
Method
The Request Method (VERB)
MultipartBuilder
Builder for multipart/form-data bodies per RFC 7578.
MultipartPart
A single MIME part in a multipart body.
RateLimiter
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.
RequestBuilder
Builder for a single HTTP request.
Response
HTTP response wrapper providing convenience methods for body consumption.
RetryPolicy
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 Router with optional middleware.
ServerBuilder
Builder for configuring and starting an HTTP server.
ServerRequest
A request with parsed path parameters and query string.
StatusCode
An HTTP status code (status-code in 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.
ContentType
Well-known content types for HTTP request and response bodies.
OxiHttpError
Top-level error type for the OxiHTTP stack.
PinnedBody
A pinnable body type that implements http_body::Body.
RedirectPolicy
Policy controlling how the client handles HTTP redirects.
SameSite
The SameSite cookie attribute.

Traits§

HeaderMapExt
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.

Type Aliases§

Error
Type alias for OxiHttpError (shorter name).
Result
Type alias for Result<T, OxiHttpError>.