Permalink
Browse files

Merge branch 'connect-warnings' into develop

  • Loading branch information...
2 parents 0055517 + fa87e37 commit 84b5c90410aa3942f4473ed9da4bbf42f02a0a66 @aljimenez aljimenez committed Jun 26, 2014
Showing with 23 additions and 0 deletions.
  1. +23 −0 lib/app/middleware/mojito-parser-body.js
View
23 lib/app/middleware/mojito-parser-body.js
@@ -18,3 +18,26 @@ Export a function which can create a body parser.
@return {Object} The newly constructed body parser.
**/
module.exports = require('express').bodyParser;
+
+var express = require('express'),
+ json = express.json,
+ urlencoded = express.urlencoded;
+
+module.exports = function bodyParser(options) {
+ var _json = json(options),
+ _urlencoded = urlencoded(options);
+
+ return function (req, res, next) {
+ _json(req, res, function (err) {
+ if (err) {
+ return next(err);
+ }
+ _urlencoded(req, res, function (err) {
+ if (err) {
+ return next(err);
+ }
+ next();
+ });
+ });
+ };
+};

0 comments on commit 84b5c90

Please sign in to comment.