Skip to main content

Crate rig_http

Crate rig_http 

Source
Expand description

Rig’s transport contracts. A transport implements HttpClientExt (and, for websocket sessions, WebSocketClientExt), and every Rig provider sends through it. This crate holds no transport of its own: rig-reqwest and rig-tungstenite are the bundled ones. rig-core re-exports these modules at rig_core::http_client, rig_core::ws_client and rig_core::wasm_compat.

use rig_http::http_client::{HeaderMap, bearer_auth_header};

let mut headers = HeaderMap::new();
bearer_auth_header(&mut headers, "example-token")?;

Modules§

http_client
Transport-independent HTTP requests, lazy response bodies, and errors.
test_utilstest-utils
HTTP client doubles for tests of code that sends through an HttpClientExt.
wasm_compat
Target-dependent thread bounds, boxed futures, and executor-independent timers.
ws_clientwebsocket
Transport-independent websocket handshakes, connections, and frames. Backends preserve rejected upgrades as HTTP errors with status, headers, and body.