handle_request
handle_request
Dispatch a request over plain values instead of FastAPI objects. Performs proxy
detection, basic auth, the routing callback check,
and on_request() modification, then renders the document. The
FastAPI routes delegate to the same logic, so both paths return identical
responses. Basic auth is always on: pass basic_auth to the constructor and
send a matching Authorization header, or the call returns 401.
Parameters
method
HTTP method, such as "GET" or "POST".
url
The full request URL. Used for proxy detection and to match a registered routing callback path.
headers
Request headers as a plain dictionary.
body
The already-parsed JSON body for POST requests.
Returns
tuple[int, dict[str, str], str] — (status_code, response_headers, body).
200with the SWML document as a JSON string.307with aLocationheader and an empty body when a routing callback returned a destination.401withWWW-Authenticate: Basicand a JSON error when basic auth fails.