UNPKG

@trifrost/core

Version:

Blazingly fast, runtime-agnostic server framework for modern edge and node environments

14 lines (13 loc) 362 B
import { parseBody as uint8Parser } from './Uint8Array'; export async function parseBody(ctx, req, config) { if (!(req instanceof Request)) return {}; try { const buf = new Uint8Array(await req.arrayBuffer()); return uint8Parser(ctx, buf, config); } catch (err) { ctx.logger.error(err); return {}; } }