pub struct HttpTransportBuilder { /* private fields */ }Expand description
Builds an HttpTransport.
Header values are validated when HttpTransportBuilder::build is called,
so a chain of setters stays a chain and does not thread a Result through
every step.
Implementations§
Source§impl HttpTransportBuilder
impl HttpTransportBuilder
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Adds a header to every request — an API key, a tenant id, a trace header.
Sourcepub fn headers<K, V>(self, headers: impl IntoIterator<Item = (K, V)>) -> Self
pub fn headers<K, V>(self, headers: impl IntoIterator<Item = (K, V)>) -> Self
Adds several headers.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Bounds the whole run: connecting, headers, and streaming the body.
An agent that thinks for longer than this has its stream cut off, so a
long-running agent wants HttpTransportBuilder::connect_timeout
instead.
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Bounds only connection setup, leaving the stream itself unbounded.
Sourcepub fn client(self, client: Client) -> Self
pub fn client(self, client: Client) -> Self
Uses a caller-supplied client, for proxies, custom TLS roots, or a connection pool shared with the rest of an application.
Sourcepub fn build(self) -> Result<HttpTransport>
pub fn build(self) -> Result<HttpTransport>
Builds the transport.
§Errors
Error::Config when the URL, a header name, or a header value is not
valid, or when the HTTP client cannot be built.
Trait Implementations§
Source§impl Clone for HttpTransportBuilder
impl Clone for HttpTransportBuilder
Source§fn clone(&self) -> HttpTransportBuilder
fn clone(&self) -> HttpTransportBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more