Merge pull request #19 from murvinlai/master

check for req.method first.
This commit is contained in:
eleith 2015-11-22 09:45:35 -08:00
commit 7dfae105f6
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();
};
};