#[non_exhaustive]pub struct HttpClient { /* 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 HttpClient
impl HttpClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new HttpClient
.
Sourcepub fn set_tls_config(&mut self, cfg: ClientConfig) -> &mut Self
Available on crate features rustls
or boring
only.
pub fn set_tls_config(&mut self, cfg: ClientConfig) -> &mut Self
rustls
or boring
only.Set the ClientConfig
of this HttpClient
.
Sourcepub fn with_tls_config(self, cfg: ClientConfig) -> Self
Available on crate features rustls
or boring
only.
pub fn with_tls_config(self, cfg: ClientConfig) -> Self
rustls
or boring
only.Replace this HttpClient
with the ClientConfig
set.
Sourcepub fn maybe_with_tls_config(self, cfg: Option<ClientConfig>) -> Self
Available on crate features rustls
or boring
only.
pub fn maybe_with_tls_config(self, cfg: Option<ClientConfig>) -> Self
rustls
or boring
only.Replace this HttpClient
with an option of ClientConfig
set.
Sourcepub fn set_proxy_tls_config(&mut self, cfg: ClientConfig) -> &mut Self
Available on crate features rustls
or boring
only.
pub fn set_proxy_tls_config(&mut self, cfg: ClientConfig) -> &mut Self
rustls
or boring
only.Set the ClientConfig
for the https proxy tunnel if needed within this HttpClient
.
Sourcepub fn with_proxy_tls_config(self, cfg: ClientConfig) -> Self
Available on crate features rustls
or boring
only.
pub fn with_proxy_tls_config(self, cfg: ClientConfig) -> Self
rustls
or boring
only.Replace this HttpClient
set for the https proxy tunnel if needed within this ClientConfig
.
Sourcepub fn maybe_proxy_with_tls_config(self, cfg: Option<ClientConfig>) -> Self
Available on crate features rustls
or boring
only.
pub fn maybe_proxy_with_tls_config(self, cfg: Option<ClientConfig>) -> Self
rustls
or boring
only.Replace this HttpClient
set for the https proxy tunnel if needed within this ClientConfig
.
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§fn clone(&self) -> HttpClient
fn clone(&self) -> HttpClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HttpClient
impl Debug for HttpClient
Source§impl Default for HttpClient
impl Default for HttpClient
Source§fn default() -> HttpClient
fn default() -> HttpClient
Source§impl<State, Body> Service<State, Request<Body>> for HttpClient
impl<State, Body> Service<State, Request<Body>> for HttpClient
Auto Trait Implementations§
impl Freeze for HttpClient
impl RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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