From 87498fb5e9b56f794f3fd16a1f79de69e52824a0 Mon Sep 17 00:00:00 2001 From: Grey Date: Sun, 16 Jun 2019 20:32:26 -0700 Subject: [PATCH 1/2] make req actually emit warnings per documented behavior --- lib/private/multipart.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/private/multipart.js b/lib/private/multipart.js index ab61202..31e806e 100644 --- a/lib/private/multipart.js +++ b/lib/private/multipart.js @@ -43,9 +43,10 @@ module.exports = function toParseMultipartHTTPRequest(options) { // If parser emits `warning`, also emit it on `req` so it can be captured // by your app. When NODE_ENV != 'production', if `req._sails` exists, this // will attempt to log a message to the console using your configured logger. - // If this doesn't work, it logs a message. In production, no warnings are emitted. - if (process.env.NODE_ENV !== 'production') { - parser.on('warning', function(msg) { + // If this doesn't work, it logs a message. + parser.on('warning', function(msg) { + req.emit('warning'); + if (process.env.NODE_ENV !== 'production') { if (req._sails) { try { req._sails.log.verbose(msg); @@ -53,9 +54,7 @@ module.exports = function toParseMultipartHTTPRequest(options) { } else { debug(msg); } - });//œ - }//fi - + }//fi + });//œ }; }; - From 37682d80fa016ee016b68b245febe5c50e96b030 Mon Sep 17 00:00:00 2001 From: Grey Date: Sun, 16 Jun 2019 21:09:28 -0700 Subject: [PATCH 2/2] fixed a miss --- lib/private/multipart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/multipart.js b/lib/private/multipart.js index 31e806e..fccdb37 100644 --- a/lib/private/multipart.js +++ b/lib/private/multipart.js @@ -45,7 +45,7 @@ module.exports = function toParseMultipartHTTPRequest(options) { // will attempt to log a message to the console using your configured logger. // If this doesn't work, it logs a message. parser.on('warning', function(msg) { - req.emit('warning'); + req.emit('warning', msg); if (process.env.NODE_ENV !== 'production') { if (req._sails) { try {