pub struct HttpClient {
pub config: HttpClientConfig,
}
Fields§
§config: HttpClientConfig
Implementations§
Source§impl HttpClient
impl HttpClient
pub fn new(config: &HttpClientConfig) -> Self
Sourcepub fn builder() -> HttpClientBuilder
pub fn builder() -> HttpClientBuilder
Instantiate HTTP client builder
Sourcepub async fn send(&mut self, req: &HttpRequest) -> Result<HttpResponse, Error>
pub async fn send(&mut self, req: &HttpRequest) -> Result<HttpResponse, Error>
Send HTTP request, and return response
Sourcepub async fn download(
&mut self,
url: &str,
dest_file: &str,
) -> Result<HttpResponse, Error>
pub async fn download( &mut self, url: &str, dest_file: &str, ) -> Result<HttpResponse, Error>
Download a file
Sourcepub async fn post(
&mut self,
url: &str,
body: &HttpBody,
) -> Result<HttpResponse, Error>
pub async fn post( &mut self, url: &str, body: &HttpBody, ) -> Result<HttpResponse, Error>
Send POST request
Sourcepub async fn put(
&mut self,
url: &str,
data: &[u8],
) -> Result<HttpResponse, Error>
pub async fn put( &mut self, url: &str, data: &[u8], ) -> Result<HttpResponse, Error>
Send PUT request
pub async fn connect( &self, uri: &Url, port: &u16, message: &[u8], ) -> Result<Box<dyn BufRead>, Error>
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
Returns a copy 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 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