pub struct HttpClient { /* private fields */ }Expand description
reqwest-backed HttpConnector.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(
client: Client,
base_url: String,
auth: Arc<dyn HttpAuthProvider>,
) -> Result<Self, HttpConnectorError>
pub fn new( client: Client, base_url: String, auth: Arc<dyn HttpAuthProvider>, ) -> Result<Self, HttpConnectorError>
Construct a client. LAZY: parses base_url but contacts no backend (CF-2).
§Errors
Returns HttpConnectorError::Backend when base_url is unparseable or
the reqwest client cannot be built. The error message does NOT echo the URL.
Sourcepub fn with_config(
client: Client,
base_url: String,
auth: Arc<dyn HttpAuthProvider>,
http_config: HttpConfig,
) -> Result<Self, HttpConnectorError>
pub fn with_config( client: Client, base_url: String, auth: Arc<dyn HttpAuthProvider>, http_config: HttpConfig, ) -> Result<Self, HttpConnectorError>
Sourcepub fn from_config(
base_url: String,
auth: Arc<dyn HttpAuthProvider>,
http_config: HttpConfig,
) -> Result<Self, HttpConnectorError>
pub fn from_config( base_url: String, auth: Arc<dyn HttpAuthProvider>, http_config: HttpConfig, ) -> Result<Self, HttpConnectorError>
Build a client from an HttpConfig, constructing the reqwest client with
the configured timeout, user-agent, and default headers. LAZY (CF-2).
§Errors
As HttpClient::new.
Trait Implementations§
Source§impl HttpConnector for HttpClient
impl HttpConnector for HttpClient
Source§fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 Operation,
args: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, HttpConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 Operation,
args: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<Value, HttpConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute
operation with the caller-supplied args (a JSON object whose
keys map to path / query / header / body parameters) and return the
response body as a serde_json::Value. Read moreAuto Trait Implementations§
impl Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
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>
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 moreCreates a shared type from an unshared type.