pub fn shared_client() -> &'static ClientExpand description
Return the process-wide shared [reqwest::blocking::Client]. First
call constructs it via Client::builder() with
SHARED_CLIENT_CONNECT_TIMEOUT and
SMALL_RESPONSE_REQUEST_TIMEOUT applied; every subsequent call returns
a reference to the same instance. This helper is for top-level CLI entries
that want the default client.
Tests that need to verify a network round-trip (rather than a
cache hit) must NOT pass shared_client() to a cache-routed
helper (cached_releases, cached_releases_with,
fetch_latest_stable_version, fetch_version_for_prefix) —
RELEASES_CACHE may already be populated by a peer test, in
which case the helper returns cached data and the network is
never touched. Construct a local Client and pass it to the
cache-routed helper to skip the cache; the pointer-equality gate
in cached_releases_with routes a non-singleton client to a
direct fetch_releases call against RELEASES_URL (the
production URL — the bypass skips the cache, NOT the URL). For
full URL injection, call fetch_releases directly. Cache-routing
tests inject the fetch operation into cached_releases_with_fetch
so they can prove the bypass without scheduling a local HTTP
server.
§Panics
Panics on the first call if Client::builder().build() fails to
construct a client. Documented failure modes include TLS backend
initialization (e.g. rustls/native-tls subsystem unreachable) and
system-resolver config load failure; both are treated as setup
bugs rather than runtime errors. The
expect here, rather than propagating the error, mirrors the
inherited behavior of reqwest::blocking::Client::new() (which
is itself an infallible wrapper around builder().build().expect).