pub struct InnerHttpClient { /* private fields */ }Expand description
Internal implementation backing HttpClient.
The client is backed by a [reqwest::Client] which keeps connections alive and
can be cloned cheaply. The client also has a list of header fields to
extract from the response.
The client returns an HttpResponse. The client filters only the key value
for the give header_keys.
Implementations§
Source§impl InnerHttpClient
impl InnerHttpClient
Sourcepub async fn send_request(
&self,
method: Method,
url: String,
headers: Option<HashMap<String, String>>,
body: Option<Vec<u8>>,
timeout_secs: Option<u64>,
) -> Result<HttpResponse, HttpClientError>
pub async fn send_request( &self, method: Method, url: String, headers: Option<HashMap<String, String>>, body: Option<Vec<u8>>, timeout_secs: Option<u64>, ) -> Result<HttpResponse, HttpClientError>
Sends an HTTP request and returns an HttpResponse.
method: The HTTP method (e.g. GET, POST).url: The target URL.headers: Extra headers to send.body: Optional request body.timeout_secs: Optional request timeout in seconds.
§Errors
Returns an error if unable to send request or times out.
Sourcepub async fn to_response(
&self,
response: Response,
) -> Result<HttpResponse, HttpClientError>
pub async fn to_response( &self, response: Response, ) -> Result<HttpResponse, HttpClientError>
Converts a reqwest::Response into an HttpResponse.
§Errors
Returns an error if unable to send request or times out.
Trait Implementations§
Source§impl Clone for InnerHttpClient
impl Clone for InnerHttpClient
Source§fn clone(&self) -> InnerHttpClient
fn clone(&self) -> InnerHttpClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InnerHttpClient
impl Debug for InnerHttpClient
Source§impl Default for InnerHttpClient
impl Default for InnerHttpClient
Source§fn default() -> Self
fn default() -> Self
Creates a new default InnerHttpClient instance.
The default client is initialized with an empty list of header keys and a new reqwest::Client.
Auto Trait Implementations§
impl Freeze for InnerHttpClient
impl !RefUnwindSafe for InnerHttpClient
impl Send for InnerHttpClient
impl Sync for InnerHttpClient
impl Unpin for InnerHttpClient
impl !UnwindSafe for InnerHttpClient
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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