1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/packages/unleash-api/lib/error/validate-request.js
ivaosthu c2d24a1556 Dropping bluebird as a runtime dependency.
Still use it in some test-setup, will cleanup this laster.

closes #128
2020-02-20 08:30:36 +01:00

16 lines
346 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;