UNPKG

serverless-offline-edge-lambda

Version:

A plugin for the Serverless Framework that simulates the behavior of AWS CloudFront Edge Lambdas while developing offline.

25 lines 808 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.cloudfrontPost = void 0; const body_parser_1 = __importDefault(require("body-parser")); function cloudfrontPost() { return (req, res, next) => { if (req.method === 'POST') { body_parser_1.default.raw({ type: '*/*' })(req, res, (err) => { if (err) { next(err); } req.body = { data: req.body }; next(); }); } else { next(); } }; } exports.cloudfrontPost = cloudfrontPost; //# sourceMappingURL=cloudfront-post.middleware.js.map