pub struct ZJHttpClient {
pub global_send_header_timeout: Duration,
pub global_read_header_timeout: Duration,
pub global_read_body_timeout: Option<Duration>,
pub global_connect_timeout: Duration,
pub global_trust_store_pem: Option<TrustStorePem>,
pub global_proxy: Option<HttpsProxyOption>,
}Expand description
HTTP client with configurable timeouts and proxy settings
Fields§
§global_send_header_timeout: Duration§global_read_header_timeout: Duration§global_read_body_timeout: Option<Duration>§global_connect_timeout: Duration§global_trust_store_pem: Option<TrustStorePem>§global_proxy: Option<HttpsProxyOption>Implementations§
Source§impl ZJHttpClient
impl ZJHttpClient
Sourcepub fn builder() -> ZJHttpClientBuilder
pub fn builder() -> ZJHttpClientBuilder
Create a builder for ZJHttpClient with default values
pub fn set_proxy(self, proxy: HttpsProxyOption) -> Self
pub fn set_proxy_from_url(self, proxy_url: impl AsRef<str>) -> Result<Self>
pub fn set_connect_timeout(self, timeout: Duration) -> Self
pub async fn send(&self, req: &mut Request) -> Result<Response>
pub async fn send_header_only( &self, req: &mut Request, ) -> Result<(BoxedStream, SocketAddr)>
pub async fn send_body_only( &self, req: &mut Request, stream_to_write: BoxedStream, addr: SocketAddr, ) -> Result<Response>
Trait Implementations§
Source§impl Clone for ZJHttpClient
impl Clone for ZJHttpClient
Source§fn clone(&self) -> ZJHttpClient
fn clone(&self) -> ZJHttpClient
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 moreAuto Trait Implementations§
impl Freeze for ZJHttpClient
impl RefUnwindSafe for ZJHttpClient
impl Send for ZJHttpClient
impl Sync for ZJHttpClient
impl Unpin for ZJHttpClient
impl UnsafeUnpin for ZJHttpClient
impl UnwindSafe for ZJHttpClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more