UNPKG

bunxyz

Version:

Minimalist, fast, file-system based routing framework for Bun

21 lines (20 loc) 838 B
import type { ZodSchema } from "zod"; export declare class BunxyzRequest extends Request { params: Record<string, string>; query: Record<string, string | string[]>; validatedData?: { params?: any; query?: any; body?: any; }; constructor(input: Request, params?: Record<string, string>, query?: Record<string, string | string[]>); /** * Parses the request body as JSON and optionally validates it against a Zod schema. * @param schema Optional ZodSchema to validate the parsed body. * @returns A promise that resolves with the parsed (and potentially validated) body. * @throws {RequestValidationError} If validation fails. * @throws {SyntaxError} If the body is not valid JSON. */ json<T>(schema?: ZodSchema<T>): Promise<T>; text(): Promise<string>; }