UNPKG

hook-engine

Version:

Production-grade webhook engine with comprehensive adapter support, security, reliability, structured logging, and CLI tools.

15 lines (14 loc) 513 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeRequestBody = normalizeRequestBody; async function normalizeRequestBody(req) { if (req.body instanceof Buffer) return req.body; if (typeof req.body === "string") { return Buffer.from(req.body, "utf8"); } if (typeof req.body === "object" && req.body !== null) { return Buffer.from(JSON.stringify(req.body), "utf8"); } throw new Error("Unsupported request body format"); }