Requests for the UN list file: a typed HttpError and text bodies that survive any content type. The file fits the default 16 MiB response cap.

Values

USER_AGENT

USER_AGENT: Str "hot-dev-un-sanctions-pkg/0.1 (+https://hot.dev)"

Functions

body-snippet

fn (body: Any): Str

body-text

fn (response: Any): Str

The response body as text: the decoded string when Hot kept it as one, otherwise the body bytes decoded as UTF-8 (a CSV served as application/octet-stream, or a body that happened to parse as JSON).

get-text

fn (url: Str): Str

GET a file as text: the body as a Str, or an Err.

http-error

fn (response: ::hot::http/HttpResponse, url: Str): HttpError

Build an HttpError from a non-2xx response. Exposed for testing; every request uses it.

request

fn (method: Str, url: Str, headers: Map, body: Any): ::hot::http/HttpResponse

One request with the package User-Agent. Returns the HttpResponse on 2xx, or an Err carrying HttpError (transport failures pass through as their own Err).

Types

HttpError

HttpError type {
    status: Int,
    url: Str,
    headers: Map,
    body: Any,
    message: Str
}

A non-2xx response from the UN list server. url is the requested URL (without credentials); message is a one-line summary.