@trifrost/core
Version:
Blazingly fast, runtime-agnostic server framework for modern edge and node environments
17 lines (16 loc) • 468 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBody = parseBody;
const Uint8Array_1 = require("./Uint8Array");
async function parseBody(ctx, req, config) {
if (!(req instanceof Request))
return {};
try {
const buf = new Uint8Array(await req.arrayBuffer());
return (0, Uint8Array_1.parseBody)(ctx, buf, config);
}
catch (err) {
ctx.logger.error(err);
return {};
}
}