Requests
FlareRequest and FlareHttpContext - fields, body readers, params, cookies, and the request pipeline surface.
Every handler and middleware hook receives a FlareHttpContext (ctx in inline routes, this.ctx on controllers). The inbound message is ctx.req, a FlareRequest.
For route matching see Routing behavior. For handler return values see Requests and responses. For contract validation see HTTP contracts.
FlareRequest
Section titled “FlareRequest”A read-mostly wrapper around what arrived on the wire.
| Field | Type | Meaning |
|---|---|---|
method | string | HTTP verb as received |
url | string | Full request URL string |
path | string | Path without query string |
headers | Headers | Request headers |
rawRouteParams | Record<string, string> | Decoded :segment / *rest values |
rawQueryParams | URLSearchParams | Parsed query string |
requestId | string | Framework-assigned id (X-Request-Id when enabled) |
rawBody | ArrayBuffer | null | Bytes after buffer() / text() / json() |
signal | AbortSignal | Client disconnect signal |
startTime | number | undefined | Present when request timing is enabled |
nativeRequest | unknown | Adapter-specific raw request |
Body readers
Section titled “Body readers”| Method | Returns | Behavior |
|---|---|---|
buffer(maxBytes?) | Promise<ArrayBuffer | null> | Full body in memory |
text() | Promise<string | null> | UTF-8 text |
json() | Promise<JsonValue> | Parsed JSON; null for an empty body; rejects invalid JSON |
stream() | AsyncIterable<Uint8Array> | Chunked read without buffering |
Pick one strategy per request. After buffer() / text() / json() starts, stream() throws.
Over-limit bodies throw ContentTooLarge, mapped to 413.
FlareHttpContext
Section titled “FlareHttpContext”| Member | Purpose |
|---|---|
ctx.req | The inbound FlareRequest |
ctx.extract(descriptor) | Parsed contract values for controllers |
ctx.cookies | Read and set cookies (including signed) |
ctx.state | Per-request state tokens |
ctx.sse(producer) | Open a Server-Sent Events response |
Route params and query
Section titled “Route params and query”Without a contract, read the wire form:
host.http.get("/users/:id", (ctx) => { const id = ctx.req.rawRouteParams["id"]; const include = ctx.req.rawQueryParams.get("include"); return { id, include };});With descriptor fields on the route options, read parsed values from scope.input in the handler. Invalid shapes short-circuit with 400 before middleware (route/query) or before the handler (body).
Bodies and contracts
Section titled “Bodies and contracts”- No
bodyin descriptor: usectx.reqbody readers manually. - JSON
bodyschema: readscope.input.body(inline) orctx.extract(entry).body(controller). body: stream: iteratectx.req.stream()orscope.input.body(same iterable).