pub struct EasyHttpWebClient<I1 = (), I2 = (), P = NoPool> { /* private fields */ }
Expand description
An opiniated http client that can be used to serve HTTP requests.
You can fork this http client in case you have use cases not possible with this service example. E.g. perhaps you wish to have middleware in into outbound requests, after they passed through your “connector” setup. All this and more is possible by defining your own http client. Rama is here to empower you, the building blocks are there, go crazy with your own service fork and use the full power of Rust at your fingertips ;)
Implementations§
Source§impl EasyHttpWebClient
impl EasyHttpWebClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new EasyHttpWebClient
.
Source§impl<I1, I2, P> EasyHttpWebClient<I1, I2, P>
impl<I1, I2, P> EasyHttpWebClient<I1, I2, P>
Sourcepub fn set_tls_connector_config(
&mut self,
layer: TlsConnectorConfig,
) -> &mut Self
Available on crate features rustls
or boring
only.
pub fn set_tls_connector_config( &mut self, layer: TlsConnectorConfig, ) -> &mut Self
rustls
or boring
only.Set the [TlsConnectorLayer
] of this EasyHttpWebClient
.
Sourcepub fn with_tls_connector_config(self, layer: TlsConnectorConfig) -> Self
Available on crate features rustls
or boring
only.
pub fn with_tls_connector_config(self, layer: TlsConnectorConfig) -> Self
rustls
or boring
only.Replace this EasyHttpWebClient
with the [TlsConnectorLayer
] set.
Sourcepub fn maybe_with_tls_connector_config(
self,
layer: Option<TlsConnectorConfig>,
) -> Self
Available on crate features rustls
or boring
only.
pub fn maybe_with_tls_connector_config( self, layer: Option<TlsConnectorConfig>, ) -> Self
rustls
or boring
only.Replace this EasyHttpWebClient
with an option of [TlsConfig
] set.
Sourcepub fn set_proxy_tls_connector_config(
&mut self,
layer: TlsConnectorConfig,
) -> &mut Self
Available on crate features rustls
or boring
only.
pub fn set_proxy_tls_connector_config( &mut self, layer: TlsConnectorConfig, ) -> &mut Self
rustls
or boring
only.Set the [TlsConfig
] for the https proxy tunnel if needed within this EasyHttpWebClient
.
Sourcepub fn with_proxy_tls_connector_config(self, layer: TlsConnectorConfig) -> Self
Available on crate features rustls
or boring
only.
pub fn with_proxy_tls_connector_config(self, layer: TlsConnectorConfig) -> Self
rustls
or boring
only.Replace this EasyHttpWebClient
set for the https proxy tunnel if needed within this [TlsConfig
].
Sourcepub fn maybe_proxy_with_tls_connector_config(
self,
layer: Option<TlsConnectorConfig>,
) -> Self
Available on crate features rustls
or boring
only.
pub fn maybe_proxy_with_tls_connector_config( self, layer: Option<TlsConnectorConfig>, ) -> Self
rustls
or boring
only.Replace this EasyHttpWebClient
set for the https proxy tunnel if needed within this [TlsConfig
].
Sourcepub fn with_proxy_http_connect_version(self, version: Version) -> Self
pub fn with_proxy_http_connect_version(self, version: Version) -> Self
Set the HTTP version to use for the Http Proxy CONNECT request.
By default this is set to HTTP/1.1.
Sourcepub fn set_proxy_http_connect_version(&mut self, version: Version) -> &mut Self
pub fn set_proxy_http_connect_version(&mut self, version: Version) -> &mut Self
Set the HTTP version to use for the Http Proxy CONNECT request.
Sourcepub fn with_proxy_http_connect_auto_version(self) -> Self
pub fn with_proxy_http_connect_auto_version(self) -> Self
Set the HTTP version to auto detect for the Http Proxy CONNECT request.
Sourcepub fn set_proxy_http_connect_auto_version(&mut self) -> &mut Self
pub fn set_proxy_http_connect_auto_version(&mut self) -> &mut Self
Set the HTTP version to auto detect for the Http Proxy CONNECT request.
pub fn with_http_conn_req_inspector<T>( self, http_req_inspector: T, ) -> EasyHttpWebClient<T, I2, P>
rustls
or boring
only.pub fn with_http_serve_req_inspector<T>( self, http_req_inspector: T, ) -> EasyHttpWebClient<I1, T, P>
rustls
or boring
only.pub fn with_connection_pool<T>(self, pool: T) -> EasyHttpWebClient<I1, I2, T>
rustls
or boring
only.pub fn without_connection_pool(self) -> EasyHttpWebClient<I1, I2, NoPool>
rustls
or boring
only.Trait Implementations§
Source§impl<I1: Clone, I2: Clone, P: Clone> Clone for EasyHttpWebClient<I1, I2, P>
Available on crate features rustls
or boring
only.
impl<I1: Clone, I2: Clone, P: Clone> Clone for EasyHttpWebClient<I1, I2, P>
rustls
or boring
only.Source§impl<I1: Debug, I2: Debug, P: Debug> Debug for EasyHttpWebClient<I1, I2, P>
Available on crate features rustls
or boring
only.
impl<I1: Debug, I2: Debug, P: Debug> Debug for EasyHttpWebClient<I1, I2, P>
rustls
or boring
only.Source§impl Default for EasyHttpWebClient
impl Default for EasyHttpWebClient
Source§impl<State, BodyIn, BodyOut, P, I1, I2> Service<State, Request<BodyIn>> for EasyHttpWebClient<I1, I2, P>where
P: Pool<HttpClientService<BodyOut, I2>, BasicHttpConId, Connection: Service<State, Request<BodyIn>, Response = Response, Error: Into<BoxError> + Unpin + Send + 'static>> + Clone,
State: Clone + Send + Sync + 'static,
BodyIn: Body<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
BodyOut: Body<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
I1: RequestInspector<State, Request<BodyIn>, Error: Into<BoxError>, StateOut = State, RequestOut = Request<BodyIn>> + Clone,
I2: RequestInspector<State, Request<BodyIn>, Error: Into<BoxError>, RequestOut = Request<BodyOut>> + Clone,
impl<State, BodyIn, BodyOut, P, I1, I2> Service<State, Request<BodyIn>> for EasyHttpWebClient<I1, I2, P>where
P: Pool<HttpClientService<BodyOut, I2>, BasicHttpConId, Connection: Service<State, Request<BodyIn>, Response = Response, Error: Into<BoxError> + Unpin + Send + 'static>> + Clone,
State: Clone + Send + Sync + 'static,
BodyIn: Body<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
BodyOut: Body<Data: Send + 'static, Error: Into<BoxError>> + Unpin + Send + 'static,
I1: RequestInspector<State, Request<BodyIn>, Error: Into<BoxError>, StateOut = State, RequestOut = Request<BodyIn>> + Clone,
I2: RequestInspector<State, Request<BodyIn>, Error: Into<BoxError>, RequestOut = Request<BodyOut>> + Clone,
Auto Trait Implementations§
impl<I1, I2, P> Freeze for EasyHttpWebClient<I1, I2, P>
impl<I1 = (), I2 = (), P = NoPool> !RefUnwindSafe for EasyHttpWebClient<I1, I2, P>
impl<I1, I2, P> Send for EasyHttpWebClient<I1, I2, P>
impl<I1, I2, P> Sync for EasyHttpWebClient<I1, I2, P>
impl<I1, I2, P> Unpin for EasyHttpWebClient<I1, I2, P>
impl<I1 = (), I2 = (), P = NoPool> !UnwindSafe for EasyHttpWebClient<I1, I2, P>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<State, S, Body> HttpClientExt<State> for S
impl<State, S, Body> HttpClientExt<State> for S
Source§type ExecuteResponse = Response<Body>
type ExecuteResponse = Response<Body>
execute
method.Source§type ExecuteError = <S as Service<State, Request<Body>>>::Error
type ExecuteError = <S as Service<State, Request<Body>>>::Error
execute
method.Source§fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
GET
request to a URL. Read moreSource§fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
POST
request to a URL. Read moreSource§fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
PUT
request to a URL. Read moreSource§fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
PATCH
request to a URL. Read moreSource§fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
DELETE
request to a URL. Read moreSource§fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
HEAD
request to a URL. Read moreSource§fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, S, State, <S as HttpClientExt<State>>::ExecuteResponse>
Source§fn execute(
&self,
ctx: Context<State>,
request: Request<Body>,
) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
fn execute( &self, ctx: Context<State>, request: Request<Body>, ) -> impl Future<Output = Result<<S as HttpClientExt<State>>::ExecuteResponse, <S as HttpClientExt<State>>::ExecuteError>>
Request
. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more