pub struct HttpClient { /* private fields */ }Expand description
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub async fn connect_h2(addr: SocketAddr, host: &str) -> Result<Self, HttpError>
pub async fn connect_h2(addr: SocketAddr, host: &str) -> Result<Self, HttpError>
Connect using HTTP/2 over TLS.
Sourcepub async fn connect_h2_with_timeout(
addr: SocketAddr,
host: &str,
timeout_ms: u64,
) -> Result<Self, HttpError>
pub async fn connect_h2_with_timeout( addr: SocketAddr, host: &str, timeout_ms: u64, ) -> Result<Self, HttpError>
Connect using HTTP/2 over TLS with a timeout (milliseconds).
Sourcepub async fn connect_h1(addr: SocketAddr, host: &str) -> Result<Self, HttpError>
pub async fn connect_h1(addr: SocketAddr, host: &str) -> Result<Self, HttpError>
Connect using HTTP/1.1 over TLS.
Sourcepub async fn connect_h1_plain(
addr: SocketAddr,
host: &str,
) -> Result<Self, HttpError>
pub async fn connect_h1_plain( addr: SocketAddr, host: &str, ) -> Result<Self, HttpError>
Connect using HTTP/1.1 over plaintext TCP.
Sourcepub fn get(&mut self, path: &str) -> RequestBuilder<'_>
pub fn get(&mut self, path: &str) -> RequestBuilder<'_>
Build a GET request.
Sourcepub fn post(&mut self, path: &str) -> RequestBuilder<'_>
pub fn post(&mut self, path: &str) -> RequestBuilder<'_>
Build a POST request.
Sourcepub fn put(&mut self, path: &str) -> RequestBuilder<'_>
pub fn put(&mut self, path: &str) -> RequestBuilder<'_>
Build a PUT request.
Sourcepub fn delete(&mut self, path: &str) -> RequestBuilder<'_>
pub fn delete(&mut self, path: &str) -> RequestBuilder<'_>
Build a DELETE request.
Sourcepub fn peer_will_close(&self) -> bool
pub fn peer_will_close(&self) -> bool
Whether the peer has signalled the connection will close. For H1
this reflects Connection: close on the most recent response (or
the HTTP/1.0 default); for H2 this reflects a GOAWAY frame. The
Pool honours this automatically via the
guard returned by Pool::client.
Auto Trait Implementations§
impl !RefUnwindSafe for HttpClient
impl !UnwindSafe for HttpClient
impl Freeze for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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