pub struct HttpClientConfig {
pub timeout: Duration,
pub user_agent: String,
pub proxy: Option<String>,
pub pool_idle_timeout: Duration,
pub pool_max_idle_per_host: usize,
}Expand description
HTTP client configuration
Fields§
§timeout: DurationRequest timeout
user_agent: StringUser-Agent header
proxy: Option<String>Optional proxy URL
Supports HTTP/HTTPS proxies with optional authentication:
http://proxy.example.com:8080http://user:password@proxy.example.com:8080
Security Note: Embedded credentials in the URL are supported. Avoid logging proxy URLs directly as they may contain secrets.
pool_idle_timeout: DurationConnection pool idle timeout
pool_max_idle_per_host: usizeMaximum idle connections per host
Implementations§
Source§impl HttpClientConfig
impl HttpClientConfig
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set request timeout
Sourcepub fn with_timeout_secs(self, secs: u64) -> Self
pub fn with_timeout_secs(self, secs: u64) -> Self
Set request timeout in seconds
Sourcepub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
pub fn with_user_agent(self, user_agent: impl Into<String>) -> Self
Set User-Agent header
Sourcepub fn with_proxy(self, proxy: impl Into<String>) -> Self
pub fn with_proxy(self, proxy: impl Into<String>) -> Self
Set proxy URL
Sourcepub fn with_optional_proxy(self, proxy: Option<String>) -> Self
pub fn with_optional_proxy(self, proxy: Option<String>) -> Self
Set optional proxy URL
Sourcepub fn with_pool_idle_timeout(self, timeout: Duration) -> Self
pub fn with_pool_idle_timeout(self, timeout: Duration) -> Self
Set connection pool idle timeout
Sourcepub fn with_pool_max_idle_per_host(self, max: usize) -> Self
pub fn with_pool_max_idle_per_host(self, max: usize) -> Self
Set maximum idle connections per host
Trait Implementations§
Source§impl Clone for HttpClientConfig
impl Clone for HttpClientConfig
Source§fn clone(&self) -> HttpClientConfig
fn clone(&self) -> HttpClientConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpClientConfig
impl Debug for HttpClientConfig
Auto Trait Implementations§
impl Freeze for HttpClientConfig
impl RefUnwindSafe for HttpClientConfig
impl Send for HttpClientConfig
impl Sync for HttpClientConfig
impl Unpin for HttpClientConfig
impl UnwindSafe for HttpClientConfig
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