diff --git a/lib/private/multipart.js b/lib/private/multipart.js index ab61202..fccdb37 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', msg); + 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 + });//œ }; }; -