pub struct HttpClient { /* private fields */ }Expand description
HTTP Client with convenience methods
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_default_headers(self, headers: Vec<(String, String)>) -> Self
pub fn with_default_headers(self, headers: Vec<(String, String)>) -> Self
Set default headers for all requests
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set default timeout for all requests
Sourcepub fn with_follow_redirects(self, follow: bool) -> Self
pub fn with_follow_redirects(self, follow: bool) -> Self
Enable following redirects by default
Sourcepub fn get(&self, url: &str) -> HttpRequest
pub fn get(&self, url: &str) -> HttpRequest
Create a GET request
Sourcepub fn post(&self, url: &str) -> HttpRequest
pub fn post(&self, url: &str) -> HttpRequest
Create a POST request
Sourcepub fn put(&self, url: &str) -> HttpRequest
pub fn put(&self, url: &str) -> HttpRequest
Create a PUT request
Sourcepub fn delete(&self, url: &str) -> HttpRequest
pub fn delete(&self, url: &str) -> HttpRequest
Create a DELETE request
Sourcepub fn patch(&self, url: &str) -> HttpRequest
pub fn patch(&self, url: &str) -> HttpRequest
Create a PATCH request
Sourcepub fn request(&self, method: HttpMethod, url: &str) -> HttpRequest
pub fn request(&self, method: HttpMethod, url: &str) -> HttpRequest
Create a request with a specific method
Sourcepub async fn execute_endpoint(
&self,
manager: CollectionManager,
col_name: &str,
ep_name: &str,
) -> HttpResult<HttpResponse>
pub async fn execute_endpoint( &self, manager: CollectionManager, col_name: &str, ep_name: &str, ) -> HttpResult<HttpResponse>
Execute a request from a collection endpoint
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
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 HttpClient
impl Debug for HttpClient
Source§impl Default for HttpClient
impl Default for HttpClient
Source§fn default() -> HttpClient
fn default() -> HttpClient
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HttpClient
impl RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnwindSafe for HttpClient
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