Expand description
rustlavel-client: the outbound HTTP client.
Written on Tokio’s TCP the same way the server is, with TLS delegated to rustls — the framework writes its own protocols but never its own cryptography. It exists because the AI and MCP packages need to call out, and because an application often does too.
ⓘ
let response = Client::new()
.post("https://api.example.com/v1/things")
.header("authorization", format!("Bearer {token}"))
.json(Json::object([("name", "widget".into())]))
.send()
.await?;Re-exports§
pub use fake::Fake;pub use fake::FakeResponse;pub use breaker::CircuitBreaker;pub use breaker::Permit;pub use breaker::State as CircuitState;pub use stream::Body;pub use stream::ServerSentEvent;pub use stream::SseReader;
Modules§
- breaker
- A circuit breaker for outbound calls.
- fake
- Faking outbound requests.
- stream
- Streaming response bodies, and the server-sent events AI providers use.
- url
- URL parsing for outbound requests.
Structs§
- Client
- Shared settings for outbound requests.
- Client
Response - A response from an outbound request.
- Request
Builder - One outbound request being assembled.
Enums§
- Connection
- Either a plain or a TLS-wrapped connection.
Functions§
- connect
- Open a connection, negotiating TLS when the URL asks for it.