Skip to content

smelt.http

Tier: Host - Available in every runtime, including headless mode.

Classification: Supported - Primary alpha facade for user config and plugins.

Asynchronous HTTP get/post. Yields the calling coroutine until the response lands; runtime stays responsive. Errors use the (value, err_string) convention.

smelt.http.get

fun(url: string, opts: table?): { status: integer, final_url: string, body: string, body_encoding: string?, headers: table, truncated: boolean }?, string?

Perform an HTTP GET against url. Yields the calling coroutine until the response lands; the runtime stays responsive throughout. opts accepts headers, timeout_secs, max_redirects, max_response_bytes, and max_retries. The total timeout includes retries. truncated reports that the body limit was reached. Non-UTF-8 response bytes are base64 encoded in body and reported by body_encoding = "base64". Cancellation of the parent task drops the in-flight request and raises cancelled from this call.

smelt.http.post

fun(url: string, body: string?, opts: table?): { status: integer, final_url: string, body: string, body_encoding: string?, headers: table, truncated: boolean }?, string?

Perform an HTTP POST against url with body bytes. Yields the calling coroutine until the response lands. Same return shape as smelt.http.get.