Expand description
Shared HTTP client factory and helpers for downloads and JSON index fetches.
Functionsยง
- client
- Build the shared reqwest client (rustls, gzip, redirects, sane timeouts).
- get_
cached_ github_ json - GitHub API variant of
get_cached_json, preserving GitHub headers and token handling while adding stale/offline cache behavior. - get_
cached_ github_ json_ from_ urls - Cached GitHub JSON with transport failover.
cache_identityis the canonical upstream URL, so direct and proxied transports share one cache. - get_
cached_ json - Fetch JSON with a persistent URL-keyed cache. Online requests refresh the cache; failures fall back to stale data. Offline mode never makes a request.
- get_
cached_ source_ json - Fetch cached JSON with explicitly configured source headers.
- get_
cached_ text - Fetch text with the same stale-cache behavior as
get_cached_json. - get_
cached_ text_ from_ urls - Fetch public GitHub Web metadata through ordered transports, sharing one canonical cache entry and retaining stale/offline behavior. Unlike API requests this deliberately sends neither API headers nor authorization.
- get_
github_ json - Fetch JSON from the GitHub API with the recommended headers, honoring a
GITHUB_TOKEN/GH_TOKENenv var to raise the rate limit when present. GitHub returns 403 for API requests missing anAccept/X-GitHub-Api-Versionheader under load, so we always send them. - get_
github_ json_ from_ urls - Try multiple transports for one GitHub JSON resource. Authorization is sent only to the official GitHub API host, never to a third-party proxy.
- get_
json - Fetch a URL and deserialize the JSON body.
- get_
text - Fetch a URL and return the body as text.
- github_
token - Read a GitHub token from the usual env vars, if set and non-empty.
- github_
url_ candidates - Build unique candidate transports in source order for one GitHub resource.
- github_
url_ for_ source - Rewrite an official GitHub API, raw-content, or release URL through one
configured source. Sources whose bases embed the canonical GitHub URL (such
as
https://gh-proxy.com/https://github.com/) also proxy raw content. - join_
url - Join a base URL (which may or may not end in
/) with a path tail. - render_
template - Substitute
{version},{os},{arch},{file},{ext}placeholders in a URL template. Joins base + tail if the template ends with/.