mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 15:34:26 +01:00
Improve raw body parser to handle skipped parsing and ended streams
This commit is contained in:
@@ -30,8 +30,8 @@ module.exports = function(RED) {
|
||||
var rawDataRoutes = new Set();
|
||||
|
||||
function rawBodyParser(req, res, next) {
|
||||
if (req.skipRawBodyParser) { next(); } // don't parse this if told to skip
|
||||
if (req._body) { return next(); }
|
||||
if (req.skipRawBodyParser || req._body || req.readableEnded) return next();
|
||||
|
||||
req.body = "";
|
||||
req._body = true;
|
||||
|
||||
@@ -323,7 +323,9 @@ module.exports = function(RED) {
|
||||
if (this.upload) {
|
||||
var mp = multer({ storage: multer.memoryStorage() }).any();
|
||||
multipartParser = function(req,res,next) {
|
||||
if(req.readableEnded || req._body) return next();
|
||||
mp(req,res,function(err) {
|
||||
req._body = true;
|
||||
next(err);
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user