pub struct HttpClient { /* private fields */ }Expand description
The catalog’s HTTP client, handed to an AuthManager so its own
requests share the catalog’s connection pool and configuration.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_auth_session(&self, auth_session: Arc<dyn AuthSession>) -> Self
pub fn with_auth_session(&self, auth_session: Arc<dyn AuthSession>) -> Self
The same client authenticating with auth_session instead: a derived
auth session reuses the connection pool and headers of the client it
came from, carrying its own authentication.
Sourcepub fn without_auth_session(&self) -> Self
pub fn without_auth_session(&self) -> Self
The same client with no authentication, for the requests that must not carry it — a session refreshing its own token over the client it authenticates would otherwise recurse.
Sourcepub async fn post_form(
&self,
url: &str,
headers: &HeaderMap,
form: &HashMap<&str, &str>,
) -> Result<HttpResponse>
pub async fn post_form( &self, url: &str, headers: &HeaderMap, form: &HashMap<&str, &str>, ) -> Result<HttpResponse>
Sends a form-encoded POST and returns the response status and body,
which is what an AuthManager needs to exchange a credential for a
token. Only headers are sent; the catalog’s own extra headers are
not merged in.
Like every request, it carries this client’s session; call
Self::without_auth_session first to send it unauthenticated.
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 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§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§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>
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