diff --git a/packages/node_modules/@node-red/nodes/core/network/21-httpin.js b/packages/node_modules/@node-red/nodes/core/network/21-httpin.js index ce9577925..060d479b6 100644 --- a/packages/node_modules/@node-red/nodes/core/network/21-httpin.js +++ b/packages/node_modules/@node-red/nodes/core/network/21-httpin.js @@ -29,13 +29,6 @@ module.exports = function(RED) { var hashSum = require("hash-sum"); var rawDataRoutes = new Set(); - /** - * This middleware parses the raw body if the user enables it. - * @param {import('express').Request} req - * @param {import('express').Response} _res - * @param {import('express').NextFunction} next - * @returns - */ function rawBodyParser(req, res, next) { if (req.skipRawBodyParser) { next(); } // don't parse this if told to skip if (req._body) { return next(); } @@ -105,13 +98,13 @@ module.exports = function(RED) { } /** - * This middleware is for clone the request stream + * This middleware is for capture raw body * @param {import('express').Request} req * @param {import('express').Response} _res * @param {import('express').NextFunction} next * @returns */ - function setupRawBodyCapture(req, _res, next) { + function rawBodyCapture(req, _res, next) { var routeKey = getRouteKey({ method: req.method, url: req._parsedUrl.pathname }); // Check if routeKey exist in rawDataRoutes if (rawDataRoutes.has(routeKey)) { @@ -135,7 +128,7 @@ module.exports = function(RED) { if(typeof RED.httpNode === 'function' && (rootApp = getRootApp(RED.httpNode))) { // Add middleware to the stack - rootApp.use(setupRawBodyCapture); + rootApp.use(rawBodyCapture); // Move the middleware to top of the stack rootApp._router.stack.unshift(rootApp._router.stack.pop()); }