pub struct ClientBuilder { /* private fields */ }
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn default_headers(self, val: HeaderMap) -> Self
pub fn default_headers(self, val: HeaderMap) -> Self
Sets default headers that will be applied to all requests made through this http. These headers can be overridden by request-specific headers.
Sourcepub fn disable_connection_pool(self) -> Self
pub fn disable_connection_pool(self) -> Self
Disables the connection pooling feature. When disabled, a new connection will be created for each request.
Sourcepub fn max_idle_connections(self, val: usize) -> Self
pub fn max_idle_connections(self, val: usize) -> Self
Sets the maximum number of idle connections that can be kept in the connection pool. Once this limit is reached, older idle connections will be dropped. Applicable on feature pool, pool-hyper or pool-native-tls only
Sourcepub fn idle_connection_timeout(self, val: u64) -> Self
pub fn idle_connection_timeout(self, val: u64) -> Self
Sets the duration after which an idle connection in the pool will be closed. The timeout is specified in seconds. Applicable on feature pool, pool-hyper or pool-native-tls only
Sourcepub fn set_read_timeout(self, val: u64) -> Self
pub fn set_read_timeout(self, val: u64) -> Self
Sets the read timeout for the HTTP/1.1 connections, has no effect on HTTP/2 connections After this duration elapses without receiving any data, the read operation will fail. The timeout value is specified in seconds.
Sourcepub fn initial_max_streams(self, val: usize) -> Self
pub fn initial_max_streams(self, val: usize) -> Self
Sets the initial maximum number of streams that can be created when a new HTTP/2 connection is established. This value affects the initial stream capacity allocation and can be adjusted based on expected concurrent requests.
Sourcepub fn max_concurrent_streams(self, val: u32) -> Self
pub fn max_concurrent_streams(self, val: u32) -> Self
Sets the maximum number of concurrent HTTP/2 streams allowed per connection. Default is 100. Higher values allow more parallel requests on a single connection, but may require more memory and processing resources.
Sourcepub fn http1_only(self) -> Self
pub fn http1_only(self) -> Self
Forces the http to use HTTP/1.1 protocol only, disabling HTTP/2 support. Useful when you need to ensure HTTP/1.1 compatibility.
Sourcepub fn http2_prior_knowledge(self) -> Self
pub fn http2_prior_knowledge(self) -> Self
Enables HTTP/2 prior knowledge mode, assuming all connections will use HTTP/2. This skips the HTTP/1.1 -> HTTP/2 upgrade process.
Sourcepub fn enable_https(self) -> Self
pub fn enable_https(self) -> Self
Enables HTTPS/TLS support for secure connections. Must be called to make HTTPS requests.