check for req.method first.

This commit is contained in:
Murvin Lai 2015-11-18 18:41:03 -08:00
parent b26121ccb3
commit 672f600784
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@ exports.create = function(schema) {
};
exports.middleware = function(schema) {
return function(req, res, next) {
req.form = new Schema(schema).validate(req.route.method == "post" ? req.body : req.query);
req.form = new Schema(schema).validate((req.method || req.route.method || '').toLowerCase() == "post" ? req.body : req.query);
next();
};
};