mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
16 lines
344 B
JavaScript
16 lines
344 B
JavaScript
'use strict';
|
|
|
|
const ValidationError = require('./validation-error');
|
|
|
|
function validateRequest(req) {
|
|
return new Promise((resolve, reject) => {
|
|
if (req.validationErrors()) {
|
|
reject(new ValidationError('Invalid syntax'));
|
|
} else {
|
|
resolve(req);
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = validateRequest;
|