Function: parseJsonBody() ​
parseJsonBody(
request):Promise<Record<string,unknown>>
Defined in: index.ts:92
Parses and validates the JSON body of a request. Ensures the body is a valid JSON object (not an array or primitive).
Parameters ​
request ​
Request
The HTTP request to parse
Returns ​
Promise<Record<string, unknown>>
The parsed JSON object
Throws ​
InvalidJsonBodyError if the body is not valid JSON or not an object
Example ​
typescript
const body = await parseJsonBody(request);
const email = body.email;