Trait rama::http::service::client::HttpClientExt
pub trait HttpClientExt<State>:
Sized
+ HttpClientExtSealed<State>
+ Send
+ Sync
+ 'static {
type ExecuteResponse;
type ExecuteError;
// Required methods
fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>;
fn execute(
&self,
ctx: Context<State>,
request: Request<Body>,
) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>;
}
Expand description
Extends an Http Client with high level features, to facilitate the creation and sending of http requests, in a more ergonomic way.
Required Associated Types§
type ExecuteResponse
type ExecuteResponse
The response type returned by the execute
method.
type ExecuteError
type ExecuteError
The error type returned by the execute
method.
Required Methods§
fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
Convenience method to make a HEAD
request to a URL.
§Errors
This method fails whenever the supplied Url
cannot be parsed.
fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, Self, State, Self::ExecuteResponse>
fn execute(
&self,
ctx: Context<State>,
request: Request<Body>,
) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>
fn execute( &self, ctx: Context<State>, request: Request<Body>, ) -> impl Future<Output = Result<Self::ExecuteResponse, Self::ExecuteError>>
Object Safety§
This trait is not object safe.