Expand description
Transport-independent HTTP requests, lazy response bodies, and errors.
use rig_http::http_client::{NoBody, Request};
let request = Request::get("https://example.com/v1/models").body(NoBody)?;
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. - 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
- A request with an empty body.
- 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, the transport’s own error, or a client that could not be built.
Traits§
- Http
Client Ext - An HTTP client Rig sends through: unary, multipart and streaming requests.
Functions§
- text
- Reads
response’s body as text, replacing invalid UTF-8.
Type Aliases§
- 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.