Merge pull request #19 from murvinlai/master
check for req.method first.
This commit is contained in:
commit
7dfae105f6
|
@ -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();
|
||||
};
|
||||
};
|
||||
|
|
Reference in New Issue