API REFERENCE
Request
import { getPathname, getQueryParams, getQueryParam, parseJson, parseUrlEncoded, parseFormData, parseText, parseBody, parseCookies, getCookie, } from '@rasenganjs/futon';
Standalone functions over the Web API Request — every one of them takes a Request and returns a plain value, so they work equally well inside a handler, a middleware, or a test. See Request Utilities and Cookies for usage.
URL Helpers
function getPathname(request: Request): string; function getQueryParams(request: Request): Record<string, string>; function getQueryParam(request: Request, key: string): string | null;
Inside a handler, prefer ctx.query — it's lazily parsed and cached per
request. Reach for getQueryParams() / getQueryParam() when you only have a
raw Request and no Context (e.g. inside a custom adapter or a test).
Body Parsers
function parseJson<T = unknown>(request: Request): Promise<T>; function parseUrlEncoded(request: Request): Promise<Record<string, string>>; function parseFormData(request: Request): Promise<FormData>; function parseText(request: Request): Promise<string>; function parseBody<T = unknown>( request: Request ): Promise<T | Record<string, string> | FormData | string>;
parseBody()'s detection order: application/json → application/x-www-form-urlencoded → multipart/form-data → falls back to text for everything else (including text/*).
These parsers consume the underlying ReadableStream. Call exactly one of
them per request, and do it early in the middleware chain — a second call will
throw or return an empty result.
Cookies
function parseCookies(request: Request): Record<string, string>; function getCookie(request: Request, name: string): string | undefined;
parseCookies() reads the Cookie header into a plain key-value map (handling multiple cookies and URL-decoding). getCookie() is a shorthand for a single name. For setting cookies on the way out, see setCookie() on the Response reference.
