export type BodyData = Record export async function parseBody( r: Request | Response ): Promise { let body: Record = {} const contentType = r.headers.get('Content-Type') if ( contentType && (contentType.startsWith('multipart/form-data') || contentType === 'application/x-www-form-urlencoded') ) { const form: Record = {} body = [...(await r.formData())].reduce((acc, cur) => { acc[cur[0]] = cur[1] return acc }, form) } return body as BodyType }