Expand description
The bundled reqwest HTTP transport for Rig.
ReqwestClient::default() is the process-wide client: built once on
first use and shared by every clone, so every provider client made with
it shares one connection pool. Construction never fails. On a host with
no CA certificates, the rustls build trusts the bundled Mozilla roots
instead. When reqwest still cannot build its client, every send reports
that build failure in-band.
Native requests and bodies enter the captured Tokio context on each poll
(rig_http::runtime), using a lazy fallback when no runtime is current. Callers retain ownership;
dropping an operation cancels local work, not accepted remote work. Hosts
must keep their runtime driven with I/O and timers enabled until operations
finish. Missing drivers can panic; a stopped runtime causes I/O failure.
use rig_reqwest::ReqwestClient;
let shared = ReqwestClient::default();
let custom = ReqwestClient::from(rig_reqwest::reqwest::Client::new());Re-exports§
pub use reqwest;
Structs§
- Reqwest
Client - A reqwest client implementing
HttpClientExt. - Reqwest
Middleware Client reqwest-middleware-native-tlsorreqwest-middleware-rustls - A configured middleware client implementing
HttpClientExt.
Functions§
- from_
reqwest - Wrap a reqwest transport error as
Error::Instance, retaining its source. - multipart_
form - Render a
MultipartFormas areqwest::multipart::Form. - non_
success_ body_ error - The error a non-success reply becomes, read from its body’s chunks: its
status and headers, and at most the first 64 KiB of the body decoded as
text by its charset, with a truncation marker when there was more. The
body is read until one byte past the limit or its first error; the bytes
read before an error are kept, and with none the error is the text. The
rest of
bodyis left unread for the caller. Every transport that gives providers rig-reqwest’s errors builds them here, so the same reply gives the same error whichever reads it. - shared
- The process-wide client, erased behind
DynHttpClient.