Response:ready() -> ResponseWait until this operation completes, then return the same handle for chaining. Raises if the operation failed. A completed handle returns at once.
In the guide: Call a web API
handle2 methods, 4 fields
The in-flight result of an HTTP request, which runs while the app goes on; payload fields raise until it is ready — await :ready() or datumhue.ready, or probe state. An HTTP error status is data (status), not a failure; only transport-level errors fail the handle. Dropping an unawaited handle discards its outcome (the request still runs).
HttpMount:get, HttpMount:post, HttpMount:put, HttpMount:patch, HttpMount:delete, HttpMount:head| Field | Type | Access | Description |
|---|---|---|---|
state | ReadyState | read-only | Completion state of this operation. Reading it never raises or suspends; a failed operation's error surfaces at :ready(). |
status | integer | read-only | HTTP status code. |
headers | table<string, string> | read-only | Response headers (keys lowercased). |
body | Bytes | read-only | Response body as opaque Bytes. |
Response:ready() -> ResponseWait until this operation completes, then return the same handle for chaining. Raises if the operation failed. A completed handle returns at once.
In the guide: Call a web API
Response:on_done(callback?: fun(handle: Response))Set, replace, or clear (pass nil) the callback run once, as a callback of its own, when this operation leaves pending. On a handle that has already left it, the callback runs after the current callback returns, never during this call. A set callback keeps the operation's outcome alive, even with no other reference to the handle, and keeps the app running until it runs or is cleared.