pub struct HttpClientBuilder { /* private fields */ }Expand description
Builder for HttpClient. Construct via HttpClient::api /
HttpClient::sse or HttpClient::builder.
Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
Sourcepub fn timeouts(self, connect: Duration, total: Duration) -> Self
pub fn timeouts(self, connect: Duration, total: Duration) -> Self
Overrides connect and total timeouts.
Sourcepub fn max_bytes(self, max_bytes: usize) -> Self
pub fn max_bytes(self, max_bytes: usize) -> Self
Overrides the response body byte cap (Api profile only).
Sourcepub fn retry(self, policy: RetryPolicy) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
Sets the retry policy.
Sourcepub fn bearer(self, token: impl Into<String>) -> Self
pub fn bearer(self, token: impl Into<String>) -> Self
Sets a default bearer token for every request.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Sets the User-Agent header.
Sourcepub fn default_header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn default_header(self, name: HeaderName, value: HeaderValue) -> Self
Adds a default header sent on every request.
Sourcepub fn use_system_proxy(self) -> Self
pub fn use_system_proxy(self) -> Self
Honors system proxy environment variables (default: ignores them).
Sourcepub fn cancellation_token(self, token: CancellationToken) -> Self
pub fn cancellation_token(self, token: CancellationToken) -> Self
Attaches a cancellation token observed during retries.
Sourcepub fn build(self) -> Result<HttpClient, HttpError>
pub fn build(self) -> Result<HttpClient, HttpError>
Builds the client.
Trait Implementations§
Source§impl Clone for HttpClientBuilder
impl Clone for HttpClientBuilder
Auto Trait Implementations§
impl Freeze for HttpClientBuilder
impl RefUnwindSafe for HttpClientBuilder
impl Send for HttpClientBuilder
impl Sync for HttpClientBuilder
impl Unpin for HttpClientBuilder
impl UnsafeUnpin for HttpClientBuilder
impl UnwindSafe for HttpClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more