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 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 (e.g. localhost mock server testing), call
either fetch_releases directly with the mock URL — see
fetch_releases_against_localhost_mock_returns_parsed — or use
the cache-aware seam cached_releases_with_url, which routes
the non-singleton bypass branch through the supplied URL while
preserving the singleton/cache routing identical to
cached_releases_with.
§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).