Skip to main content

Crate rig_reqwest

Crate rig_reqwest 

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

ReqwestClient
A reqwest client implementing HttpClientExt.
ReqwestMiddlewareClientreqwest-middleware-native-tls or reqwest-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 MultipartForm as a reqwest::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 body is 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.