Expand description
Transport-independent HTTP requests, lazy response bodies, and errors.
use rig_http::http_client::{Bytes, Request};
let request = Request::get("https://example.com/v1/models").body(Bytes::new())?;
assert_eq!(request.uri().path(), "/v1/models");Re-exports§
pub use middleware::Exchange;pub use middleware::HttpMiddleware;pub use multipart::MultipartForm;
Modules§
- framing
- Incremental SSE and newline-delimited framing of response bytes.
SSE dispatch requires a blank line; incomplete events are not flushed at EOF.
NDJSON permits a final unterminated line through
NdjsonFramer::finish. A framer holds at most its limit (FRAME_LIMITunless given another) plus one byte of a frame: a larger frame is refused asTooLarge. - middleware
- Transport-boundary middleware for
DynHttpClient. Attach hooks withwith_middleware. - multipart
- Transport-neutral multipart fields and byte encoding.
Structs§
- Builder
- An HTTP request builder
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- DynHttp
Client - A type-erased, cheaply cloneable HTTP transport.
- Header
Map - A specialized multimap for header names and values.
- Header
Value - Represents an HTTP header field value.
- Method
- The Request Method (VERB)
- NoBody
- The empty body of a WebSocket handshake request. An HTTP request with no
body sends
Bytes::new(). - Request
- Represents an HTTP request.
- Response
- Represents an HTTP response
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.). - Uri
- The URI component of a request.
Enums§
- Error
- Why an HTTP request failed: a protocol or header error, a non-success reply, or the transport’s own error, which says whether sending the same request again may work.
Traits§
- Http
Client Ext - An HTTP client Rig sends through: unary, multipart and streaming requests.
Functions§
- retryable_
status - The one status → retryable table.
- text
- Reads
response’s body as text, replacing invalid UTF-8.
Type Aliases§
- BoxError
Non- target_family=wasm - A boxed error:
Send + Syncexcept on wasm. - Boxed
Stream - The body of a streaming response: the transport’s own chunks, boxed.
- Lazy
Body - A response body that is read when awaited.
- Result
- A result with an HTTP
Error. - Streaming
Response - A response whose body streams.