handleRequest
Dispatch one inbound request from plain HTTP primitives and get back a
[status, headers, body] triple to write to the response. Use it to serve the
agent from a framework the SDK has no adapter for. It performs Basic Auth,
runs any routing callback, applies onSwmlRequest modifications, and renders
SWML with renderSwml(). For Hono-based hosts, mount
asRouter() instead.
Parameters
method
HTTP method, such as "GET" or "POST".
url
The full request URL.
headers
Request headers as a plain object.
body
The already-parsed JSON body for POST requests. Omit for GET.
Returns
Promise<[number, Record<string, string>, string]> — The status code,
response headers, and body string. A failed Basic Auth check returns 401
with a WWW-Authenticate header; a routing callback that redirects returns
307 with a Location header.