pub(crate) struct HttpRegistry {
client: Client,
authorization: Option<HeaderValue>,
}Expand description
A client for requests against one registry.
A GET request that fails to connect, answers 429, or answers a server error is retried up to four attempts with a doubling delay. The authorization value is marked sensitive.
Fields§
§client: ClientImplementations§
Source§impl HttpRegistry
impl HttpRegistry
Sourcepub(crate) fn new(
scheme: &str,
token: Option<&Token>,
) -> Result<Self, RegistryError>
pub(crate) fn new( scheme: &str, token: Option<&Token>, ) -> Result<Self, RegistryError>
A client that sends token as Authorization: <scheme> <value>, or
no authorization without a token.
Sourcepub(crate) fn bare(token: &Token) -> Result<Self, RegistryError>
pub(crate) fn bare(token: &Token) -> Result<Self, RegistryError>
A client that sends token as the whole Authorization value.
fn build(authorization: Option<String>) -> Result<Self, RegistryError>
Sourcepub(crate) async fn get(
&self,
url: &Url,
) -> Result<Option<String>, RegistryError>
pub(crate) async fn get( &self, url: &Url, ) -> Result<Option<String>, RegistryError>
The response body at url, or None when the registry answers 404.
Sourcepub(crate) async fn put(
&self,
url: &Url,
body: Vec<u8>,
) -> Result<String, RegistryError>
pub(crate) async fn put( &self, url: &Url, body: Vec<u8>, ) -> Result<String, RegistryError>
Send body to url once and return the response body.
An upload is not retried, because the caller checks the registry afterwards.
async fn lookup(&self, url: &Url) -> Result<Option<String>, RegistryError>
async fn attempt(&self, url: &Url) -> Result<Option<String>, RegistryError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HttpRegistry
impl !RefUnwindSafe for HttpRegistry
impl !UnwindSafe for HttpRegistry
impl Send for HttpRegistry
impl Sync for HttpRegistry
impl Unpin for HttpRegistry
impl UnsafeUnpin for HttpRegistry
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