pub struct HttpClientBuilder { /* private fields */ }Expand description
HTTP client builder with retry support
This builder creates a reqwest_middleware::ClientWithMiddleware that includes
automatic retry functionality for transient failures.
Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
Sourcepub fn connect_timeout(self, connect_timeout: Duration) -> Self
pub fn connect_timeout(self, connect_timeout: Duration) -> Self
Set connection timeout
Sourcepub fn read_timeout(self, read_timeout: Duration) -> Self
pub fn read_timeout(self, read_timeout: Duration) -> Self
Set read timeout
Sourcepub fn pool_max_idle_per_host(self, max_idle: usize) -> Self
pub fn pool_max_idle_per_host(self, max_idle: usize) -> Self
Set connection pool size
Sourcepub fn pool_idle_timeout(self, idle_timeout: Duration) -> Self
pub fn pool_idle_timeout(self, idle_timeout: Duration) -> Self
Set pool idle timeout
Sourcepub fn user_agent(self, user_agent: String) -> Self
pub fn user_agent(self, user_agent: String) -> Self
Set User-Agent
Sourcepub fn enable_gzip(self, enable: bool) -> Self
pub fn enable_gzip(self, enable: bool) -> Self
Enable/disable Gzip compression
Sourcepub fn enable_brotli(self, enable: bool) -> Self
pub fn enable_brotli(self, enable: bool) -> Self
Enable/disable Brotli compression
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set max retry attempts
Sourcepub fn retry_initial_delay(self, delay: Duration) -> Self
pub fn retry_initial_delay(self, delay: Duration) -> Self
Set retry initial delay
Sourcepub fn retry_max_delay(self, delay: Duration) -> Self
pub fn retry_max_delay(self, delay: Duration) -> Self
Set retry max delay
Sourcepub fn build(self) -> Result<ClientWithMiddleware>
pub fn build(self) -> Result<ClientWithMiddleware>
Build HTTP client with middleware chain
This method builds a reqwest_middleware::ClientWithMiddleware that includes
automatic retry functionality using exponential backoff for transient failures.
§Returns
Returns a ClientWithMiddleware that can be used like a regular reqwest::Client
but with automatic retry on transient errors.
Sourcepub fn build_plain(self) -> Result<Client>
pub fn build_plain(self) -> Result<Client>
Build HTTP client without retry support
This method returns a plain reqwest::Client without any middleware.
Use build for retry support.