pub struct HttpClient { /* private fields */ }Expand description
HTTP client wrapper
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn builder() -> HttpClientBuilder
pub fn builder() -> HttpClientBuilder
Create a new HTTP client builder
Sourcepub async fn fetch<R: DeserializeOwned>(&self, url: &str) -> Response<R>
pub async fn fetch<R: DeserializeOwned>(&self, url: &str) -> Response<R>
GET request, returns JSON deserialized to R
Sourcepub async fn post_json<B: Serialize, R: DeserializeOwned>(
&self,
url: &str,
body: &B,
) -> Response<R>
pub async fn post_json<B: Serialize, R: DeserializeOwned>( &self, url: &str, body: &B, ) -> Response<R>
POST with JSON body, returns JSON deserialized to R
Sourcepub async fn post_form<F: Serialize, R: DeserializeOwned>(
&self,
url: &str,
form: &F,
) -> Response<R>
pub async fn post_form<F: Serialize, R: DeserializeOwned>( &self, url: &str, form: &F, ) -> Response<R>
POST with form data, returns JSON deserialized to R
Sourcepub async fn patch_json<B: Serialize, R: DeserializeOwned>(
&self,
url: &str,
body: &B,
) -> Response<R>
pub async fn patch_json<B: Serialize, R: DeserializeOwned>( &self, url: &str, body: &B, ) -> Response<R>
PATCH with JSON body, returns JSON deserialized to R
Sourcepub async fn get_raw(&self, url: &str) -> Response<RawResponse>
pub async fn get_raw(&self, url: &str) -> Response<RawResponse>
GET request returning raw response body
Sourcepub fn post(&self, url: &str) -> BitreqRequestBuilder
pub fn post(&self, url: &str) -> BitreqRequestBuilder
POST request builder for complex cases
Sourcepub fn get(&self, url: &str) -> BitreqRequestBuilder
pub fn get(&self, url: &str) -> BitreqRequestBuilder
GET request builder for complex cases
Sourcepub fn patch(&self, url: &str) -> BitreqRequestBuilder
pub fn patch(&self, url: &str) -> BitreqRequestBuilder
PATCH request builder for complex cases
Sourcepub fn put(&self, url: &str) -> BitreqRequestBuilder
pub fn put(&self, url: &str) -> BitreqRequestBuilder
PUT request builder for complex cases
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 (const: unstable) · 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
Auto Trait Implementations§
impl Freeze for HttpClient
impl RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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