Skip to main content

HttpClientFactory

Trait HttpClientFactory 

Source
pub trait HttpClientFactory: Send + Sync {
    // Required methods
    fn create(&self, config: &ConfigSet) -> RemoteResult<Box<dyn HttpClient>>;
    fn create_for_probe(
        &self,
        config: &ConfigSet,
    ) -> RemoteResult<Box<dyn HttpClient>>;
}
Expand description

Builds HTTP clients for smart-HTTP remotes.

Required Methods§

Source

fn create(&self, config: &ConfigSet) -> RemoteResult<Box<dyn HttpClient>>

Create a client honoring repository HTTP/credential config.

§Errors

Returns an error when the client cannot be constructed.

Source

fn create_for_probe( &self, config: &ConfigSet, ) -> RemoteResult<Box<dyn HttpClient>>

Create a client for a best-effort request whose failure the caller ignores, such as the advertisement load_push_plan_context reads before a push.

Such a client must not erase credentials the server refuses (no CredentialProvider::reject): the request that reports the failure does that, so it can tell the user the stored credentials were rejected rather than finding none. A factory whose clients never reject (or carry no credentials) can return create’s client.

§Errors

Returns an error when the client cannot be constructed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§