pub struct Client<'a> { /* private fields */ }
Implementations§
source§impl<'a> Client<'a>
impl<'a> Client<'a>
sourcepub fn execute(&self, request: Request) -> Result<Response<'a>>
pub fn execute(&self, request: Request) -> Result<Response<'a>>
Executes a Request
.
A Request
can be built manually with Request::new()
or obtained
from a RequestBuilder with RequestBuilder::build()
.
You should prefer to use the RequestBuilder
and
RequestBuilder::send()
.
Errors
This method fails if there was an error while sending request, redirect loop was detected or redirect limit was exhausted.
sourcepub fn request<U: IntoUrl>(&self, method: Method, url: U) -> RequestBuilder<'_>
pub fn request<U: IntoUrl>(&self, method: Method, url: U) -> RequestBuilder<'_>
Start building a Request
with the Method
and Url
.
Returns a RequestBuilder
, which will allow setting headers and
the request body before sending.
Errors
This method fails whenever the supplied Url
cannot be parsed.
sourcepub fn get<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
pub fn get<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
Convenience method to make a GET
request to a URL.
Errors
This method fails whenever the supplied Url
cannot be parsed.
sourcepub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
pub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
Convenience method to make a POST
request to a URL.
Errors
This method fails whenever the supplied Url
cannot be parsed.
sourcepub fn put<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
pub fn put<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
Convenience method to make a PUT
request to a URL.
Errors
This method fails whenever the supplied Url
cannot be parsed.
sourcepub fn patch<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
pub fn patch<U: IntoUrl>(&self, url: U) -> RequestBuilder<'_>
Convenience method to make a PATCH
request to a URL.
Errors
This method fails whenever the supplied Url
cannot be parsed.