pub struct Client {
pub config: ClientConfig,
/* private fields */
}Expand description
HTTP Client for making requests
Fields§
§config: ClientConfigClient configuration
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Create a client builder for custom configuration
Sourcepub fn get(&self, url: impl Into<String>) -> RequestBuilder
pub fn get(&self, url: impl Into<String>) -> RequestBuilder
Make a GET request
Sourcepub fn post(&self, url: impl Into<String>) -> RequestBuilder
pub fn post(&self, url: impl Into<String>) -> RequestBuilder
Make a POST request
Sourcepub fn put(&self, url: impl Into<String>) -> RequestBuilder
pub fn put(&self, url: impl Into<String>) -> RequestBuilder
Make a PUT request
Sourcepub fn delete(&self, url: impl Into<String>) -> RequestBuilder
pub fn delete(&self, url: impl Into<String>) -> RequestBuilder
Make a DELETE request
Sourcepub fn patch(&self, url: impl Into<String>) -> RequestBuilder
pub fn patch(&self, url: impl Into<String>) -> RequestBuilder
Make a PATCH request
Sourcepub fn head(&self, url: impl Into<String>) -> RequestBuilder
pub fn head(&self, url: impl Into<String>) -> RequestBuilder
Make a HEAD request
Sourcepub fn request(&self, method: Method, url: impl Into<String>) -> RequestBuilder
pub fn request(&self, method: Method, url: impl Into<String>) -> RequestBuilder
Create a request with custom method
Sourcepub async fn pool_stats(&self) -> PoolStats
pub async fn pool_stats(&self) -> PoolStats
Get connection pool statistics
Sourcepub async fn cleanup_pool(&self)
pub async fn cleanup_pool(&self)
Clean up expired connections from the pool
Sourcepub fn on_request<F>(&mut self, interceptor: F)
pub fn on_request<F>(&mut self, interceptor: F)
Add a request interceptor
The interceptor will be called before each request is sent
Sourcepub fn on_response<F>(&mut self, interceptor: F)
pub fn on_response<F>(&mut self, interceptor: F)
Add a response interceptor
The interceptor will be called after each response is received
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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