Skip to main content

Module http_client

Module http_client 

Source
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 with with_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.
DynHttpClient
A type-erased, cheaply cloneable HTTP transport.
HeaderMap
A specialized multimap for header names and values.
HeaderValue
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
StatusCode
An HTTP status code (status-code in 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§

HttpClientExt
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§

BoxedStream
The body of a streaming response: the transport’s own chunks, boxed.
LazyBody
A response body that is read when awaited.
Result
A result with an HTTP Error.
StreamingResponse
A response whose body streams.