pub struct HttpClientBuilder { /* private fields */ }Expand description
Configures an HttpClient without exposing the underlying HTTP implementation.
Product traffic should prefer HttpClientFactory::build_client or finish this builder with
Self::build_respecting_outbound_proxy_policy. The other terminal methods deliberately
bypass the factory and are restricted to documented exceptional or legacy compatibility paths.
Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
pub fn new() -> Self
pub fn default_headers(self, headers: HeaderMap) -> Self
pub fn without_redirects(self) -> Self
Sourcepub fn without_request_logging(self) -> Self
pub fn without_request_logging(self) -> Self
Suppresses request URL and response-header diagnostics.
Sourcepub fn build_respecting_outbound_proxy_policy(
self,
http_client_factory: &HttpClientFactory,
request_url: &str,
route_class: ClientRouteClass,
) -> Result<HttpClient, BuildRouteAwareHttpClientError>
pub fn build_respecting_outbound_proxy_policy( self, http_client_factory: &HttpClientFactory, request_url: &str, route_class: ClientRouteClass, ) -> Result<HttpClient, BuildRouteAwareHttpClientError>
Builds a client that honors the HttpClientFactory outbound proxy policy.
This is the preferred terminal method for product traffic. The request URL is used to
resolve a concrete direct or proxy route when the factory is configured with
crate::OutboundProxyPolicy::RespectSystemProxy.
Sourcepub fn build_with_transport_default_proxy(
self,
) -> Result<HttpClient, BuildCustomCaTransportError>
👎Deprecated: legacy compatibility only; use HttpClientFactory::build_client or build_respecting_outbound_proxy_policy
pub fn build_with_transport_default_proxy( self, ) -> Result<HttpClient, BuildCustomCaTransportError>
legacy compatibility only; use HttpClientFactory::build_client or build_respecting_outbound_proxy_policy
Builds a client using the transport’s default proxy behavior.
§Legacy compatibility only
This bypasses HttpClientFactory and therefore does not honor its configured outbound
proxy policy. New product traffic must use Self::build_respecting_outbound_proxy_policy
or HttpClientFactory::build_client.
Sourcepub fn build_direct(self) -> Result<HttpClient, BuildCustomCaTransportError>
pub fn build_direct(self) -> Result<HttpClient, BuildCustomCaTransportError>
Builds a client that connects directly without using a proxy.
§Exceptional use only
This bypasses HttpClientFactory and is appropriate only when bypassing proxy discovery
is itself required: for example, a hermetic local test fixture, a localhost callback, or
sandbox traffic whose egress routing is handled separately. Ordinary outbound product
traffic must use Self::build_respecting_outbound_proxy_policy or
HttpClientFactory::build_client.
Sourcepub fn build_with_transport_default_proxy_and_custom_ca_fallback(
self,
) -> HttpClient
👎Deprecated: legacy custom-CA fallback only; use HttpClientFactory::build_client or build_respecting_outbound_proxy_policy
pub fn build_with_transport_default_proxy_and_custom_ca_fallback( self, ) -> HttpClient
legacy custom-CA fallback only; use HttpClientFactory::build_client or build_respecting_outbound_proxy_policy
Builds a transport-default client while preserving the legacy custom-CA fallback.
§Legacy compatibility only
This preserves call sites that historically logged a custom-CA error and continued with
system roots. New product traffic must propagate construction errors through
Self::build_respecting_outbound_proxy_policy or HttpClientFactory::build_client.
Sourcepub fn build_direct_with_custom_ca_fallback(self) -> HttpClient
👎Deprecated: legacy custom-CA fallback only; use build_direct and propagate construction errors
pub fn build_direct_with_custom_ca_fallback(self) -> HttpClient
legacy custom-CA fallback only; use build_direct and propagate construction errors
Builds a direct client while preserving the legacy custom-CA fallback.
§Legacy compatibility only
This combines the exceptional proxy bypass described by Self::build_direct with the
historical behavior of logging a custom-CA error and continuing with system roots.
Trait Implementations§
Source§impl Clone for HttpClientBuilder
impl Clone for HttpClientBuilder
Source§fn clone(&self) -> HttpClientBuilder
fn clone(&self) -> HttpClientBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more