pub struct HttpTransportConfig {
pub connect_timeout: Duration,
pub request_timeout: Duration,
pub enable_compression: bool,
pub max_attempts: u8,
pub additional_headers: Vec<AdditionalHeader>,
}Expand description
Transport policy for ZaiClient.
The with_* helpers and HttpTransportConfigBuilder reject timeout values
outside their supported ranges and attempt counts outside 1..=3. Fields
remain public for direct construction; ZaiClientBuilder::build validates
the same invariants before creating any network client.
Fields§
§connect_timeout: DurationConnect timeout (default 10s).
request_timeout: DurationPer-attempt request timeout (default 60s).
enable_compression: boolWhether to advertise gzip (default true).
max_attempts: u8Maximum retry attempts, inclusive of the first attempt (default 3).
additional_headers: Vec<AdditionalHeader>Allow-listed additional headers attached to every request.
Implementations§
Source§impl HttpTransportConfig
impl HttpTransportConfig
Sourcepub fn builder() -> HttpTransportConfigBuilder
pub fn builder() -> HttpTransportConfigBuilder
Start a builder.
Sourcepub fn validate(&self) -> ZaiResult<()>
pub fn validate(&self) -> ZaiResult<()>
Validate all transport invariants, including values set through public struct fields rather than the checked builder methods.
Sourcepub fn with_request_timeout(self, d: Duration) -> ZaiResult<Self>
pub fn with_request_timeout(self, d: Duration) -> ZaiResult<Self>
Lower the per-attempt request timeout. Values above the default are rejected by this helper.
Sourcepub fn with_connect_timeout(self, d: Duration) -> ZaiResult<Self>
pub fn with_connect_timeout(self, d: Duration) -> ZaiResult<Self>
Lower the connect timeout (max 10s).
Sourcepub fn with_max_attempts(self, n: u8) -> ZaiResult<Self>
pub fn with_max_attempts(self, n: u8) -> ZaiResult<Self>
Set max attempts to 1, 2, or 3.
Sourcepub fn with_additional_header(self, header: AdditionalHeader) -> Self
pub fn with_additional_header(self, header: AdditionalHeader) -> Self
Add an allow-listed additional header.
Trait Implementations§
Source§impl Clone for HttpTransportConfig
impl Clone for HttpTransportConfig
Source§fn clone(&self) -> HttpTransportConfig
fn clone(&self) -> HttpTransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more