1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/error/validate-request.js

16 lines
344 B
JavaScript
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
2016-10-26 10:43:11 +02:00
2016-10-27 20:51:21 +02:00
const ValidationError = require('./validation-error');
2017-06-28 10:17:14 +02:00
function validateRequest(req) {
return new Promise((resolve, reject) => {
if (req.validationErrors()) {
2016-06-18 21:55:46 +02:00
reject(new ValidationError('Invalid syntax'));
} else {
resolve(req);
}
});
}
2016-12-27 21:03:50 +01:00
module.exports = validateRequest;