pub struct HttpTransportBuilder { /* private fields */ }Expand description
Configures and builds an HttpTransport.
Implementations§
Source§impl HttpTransportBuilder
impl HttpTransportBuilder
Sourcepub fn base_url(self, base_url: BaseUrl) -> Self
pub fn base_url(self, base_url: BaseUrl) -> Self
Sets the API root. The default is https://api.typesafe.ai.
Sourcepub fn retry_policy(self, retry: RetryPolicy) -> Self
pub fn retry_policy(self, retry: RetryPolicy) -> Self
Sets the retry policy, which also holds the per-attempt timeout.
Sourcepub fn user_agent(self, product: impl Into<String>) -> Self
pub fn user_agent(self, product: impl Into<String>) -> Self
Names the application for the User-Agent header, as name/version. It is placed in front
of this crate’s own jev-client/<version>.
Sourcepub const fn log_bodies(self, enabled: bool) -> Self
pub const fn log_bodies(self, enabled: bool) -> Self
Traces request and response bodies at DEBUG level, under the target
jev_client::http::body.
Off by default, and meant to stay off: a request’s state is often customer data, and an
error response can echo it back. The Authorization header is not traced either way.
Sourcepub fn clock(self, clock: Arc<dyn Clock>) -> Self
pub fn clock(self, clock: Arc<dyn Clock>) -> Self
Replaces the clock. Tests use this to observe retry delays without waiting for them.
Sourcepub fn build(self) -> Result<HttpTransport, Error>
pub fn build(self) -> Result<HttpTransport, Error>
Builds the transport.
§Errors
Fails with ErrorKind::InvalidRequest when the user agent is not a valid header value,
or when the TLS stack cannot be initialised on this system.