check for req.method first.
This commit is contained in:
parent
b26121ccb3
commit
672f600784
|
@ -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