Skip to main content

build_client

Function build_client 

Source
pub fn build_client(cfg: &UnifiConfig) -> Result<Client>
Expand description

Builds the pooled HTTP client used for every request against one controller.

No cookie jar: authentication is entirely the X-API-KEY header (see the crate’s module docs), and UniFi controllers were verified against a real controller to never send Set-Cookie for API-key-authenticated requests on either the official or internal API — a cookie store here would be dead weight, not a defense-in-depth measure.

§Errors

Returns UnifiError::ClientBuild if reqwest fails to construct the client (in practice, only from an invalid TLS configuration).