Trait HttpClientExt
pub trait HttpClientExt:
Sized
+ HttpClientExtSealed
+ Send
+ Sync
+ 'static {
Show 22 methods
// Required methods
fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_get(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>;
fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_post(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_put(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>;
fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_delete(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_patch(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_head(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn options(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_options(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn trace(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_trace(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn connect(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_connect(
self,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_request(
self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>;
fn build_from_request(
&self,
request: Request,
) -> RequestBuilder<RQBorrowedService<'_, Self>>;
fn into_build_from_request(
self,
request: Request,
) -> RequestBuilder<RQOwnedService<Self>>;
}Expand description
Convenience extension methods to build HTTP requests using a Service.
Pattern:
method(&self, ..)returns a builder backed by a borrowed service handleinto_method(self, ..)returns a builder backed by an owned service handle
Required Methods§
fn get(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn get(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a GET request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_get(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_get(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a GET request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn post(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn post(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a POST request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_post(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_post(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a POST request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn put(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn put(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a PUT request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_put(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_put(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a PUT request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a DELETE request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_delete(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_delete(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a DELETE request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a PATCH request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_patch(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_patch(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a PATCH request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn head(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn head(&self, url: impl IntoUrl) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a HEAD request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_head(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_head(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a HEAD request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn options(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn options( &self, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make an OPTIONS request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_options(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_options(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make an OPTIONS request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn trace(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn trace( &self, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a TRACE request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_trace(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_trace(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a TRACE request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn connect(
&self,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn connect( &self, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Convenience method to make a CONNECT request to a URL, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_connect(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
fn into_connect(self, url: impl IntoUrl) -> RequestBuilder<RQOwnedService<Self>>
Convenience method to make a CONNECT request to a URL, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
General purpose request builder using an explicit Method, from a borrowed Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn into_request(
self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<RQOwnedService<Self>>
fn into_request( self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<RQOwnedService<Self>>
General purpose request builder using an explicit Method, from an owned Service.
§Errors
This method fails whenever the supplied Url cannot be parsed.
fn build_from_request(
&self,
request: Request,
) -> RequestBuilder<RQBorrowedService<'_, Self>>
fn build_from_request( &self, request: Request, ) -> RequestBuilder<RQBorrowedService<'_, Self>>
Build a request builder from an already constructed Request, using a borrowed Service.
This is useful if you created a Request elsewhere (or received one) and still want
to use the fluent RequestBuilder API to mutate headers, body, extensions, etc.
fn into_build_from_request(
self,
request: Request,
) -> RequestBuilder<RQOwnedService<Self>>
fn into_build_from_request( self, request: Request, ) -> RequestBuilder<RQOwnedService<Self>>
Build a request builder from an already constructed Request, using an owned Service.
Same as Self::build_from_request but returns a builder backed by an owned Service,
so it can be moved into spawned tasks.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.