Skip to main content

Module http

Module http 

Source
Expand description

Build-time HTTP.

One blocking GET against a shared agent. No retry, no streaming, no resume, no download bookkeeping — deliberately. Resolvers run once, at build time, against small JSON APIs; the install path has its own downloader in opys-runtime and must never reach for this.

Structs§

HttpBytes
A response whose body is not text.
HttpError
Transport failure — DNS, TLS, connect, or a body that isn’t UTF-8. An HTTP status is not one of these; it comes back in HttpResponse.
HttpResponse
A completed response. The body is read eagerly: build-time payloads are JSON documents measured in kilobytes, so there is nothing to stream.

Enums§

JsonGetError
A build-time JSON GET that failed: the transport did, the server answered with a non-2xx, or the body was not the document expected.

Constants§

OPYS_USER_AGENT
Identify ourselves: the bare agent string gets rejected or rate-limited by some CDNs and by the CurseForge API. The patch component is omitted so the string doesn’t churn against the version on every release. Mirrors @opys/core’s OPYS_USER_AGENT.

Functions§

get
GET url and read the whole body. Blocking: build-time resolvers are plain synchronous functions, parallelised with std::thread::scope when they need it.
get_bytes
GET url and read the whole body as bytes.
get_json
GET url and parse the body as T.
post_json
POST body as JSON and read the whole response.