Docs: HTTP Helpers

Documentation

HTTP Helpers

Bounded metadata requests: release versions, tags and small text documents. Payload downloads use the verified Acquire helpers.

Overview

Each request times out after 30 seconds and needs its host in NEEDS.network, for example ["api.github.com:443"]; caller endpoint options only narrow that declaration. Metadata tells a recipe author what is new; it never makes an unverified payload trustworthy. For downloading files, see Acquire Helpers.

http_get

Fetch a URL and return the response body as text. The response size is bounded.

Rhai
let page = http_get("https://example.com/releases/latest.txt");

github_latest_release / github_latest_tag

Return the version of a repository's latest release, or its latest tag, with a leading v removed.

Rhai
let latest = github_latest_release("BurntSushi/ripgrep");   // "14.1.0", not "v14.1.0"
let tag = github_latest_tag("torvalds/linux");

github_download_release

Download a matching asset of the latest release, verified against a required SHA256. See Acquire Helpers.

parse_version

Strip a common prefix from a version string (v, release- or version-).

Rhai
parse_version("v1.0.0");        // "1.0.0"
parse_version("release-2.0");   // "2.0"
parse_version("version-3.1");   // "3.1"