mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
14 lines
366 B
JavaScript
14 lines
366 B
JavaScript
|
var Promise = require("bluebird");
|
||
|
var ValidationError = require('./ValidationError');
|
||
|
|
||
|
function validateRequest(req) {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
if (req.validationErrors()) {
|
||
|
reject(new ValidationError("Invalid syntax"));
|
||
|
} else {
|
||
|
resolve(req);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = validateRequest;
|