pub struct Client { /* private fields */ }Expand description
Synchronous HTTP/1.1 client.
Construct with Client::new(), then call one of the method helpers
(.get(), .post(), …) to get a RequestBuilder, configure it, and
call .send().
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a client with default settings:
timeout_ms: 30 000 (30 seconds)max_redirects: 10
Sourcepub fn timeout_ms(self, ms: u64) -> Self
pub fn timeout_ms(self, ms: u64) -> Self
Override the per-request timeout (connect + read combined).
Sourcepub fn max_redirects(self, n: u8) -> Self
pub fn max_redirects(self, n: u8) -> Self
Maximum number of redirects to follow (default: 10).
Sourcepub fn get(&self, url: &str) -> RequestBuilder<'_>
pub fn get(&self, url: &str) -> RequestBuilder<'_>
Start building a GET request.
Sourcepub fn post(&self, url: &str) -> RequestBuilder<'_>
pub fn post(&self, url: &str) -> RequestBuilder<'_>
Start building a POST request.
Sourcepub fn put(&self, url: &str) -> RequestBuilder<'_>
pub fn put(&self, url: &str) -> RequestBuilder<'_>
Start building a PUT request.
Sourcepub fn patch(&self, url: &str) -> RequestBuilder<'_>
pub fn patch(&self, url: &str) -> RequestBuilder<'_>
Start building a PATCH request.
Sourcepub fn delete(&self, url: &str) -> RequestBuilder<'_>
pub fn delete(&self, url: &str) -> RequestBuilder<'_>
Start building a DELETE request.
Sourcepub fn head(&self, url: &str) -> RequestBuilder<'_>
pub fn head(&self, url: &str) -> RequestBuilder<'_>
Start building a HEAD request.
Sourcepub fn request(&self, method: &str, url: &str) -> RequestBuilder<'_>
pub fn request(&self, method: &str, url: &str) -> RequestBuilder<'_>
Start building a request with an arbitrary HTTP method.
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 UnsafeUnpin 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