1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/packages/unleash-api/lib/error/validateRequest.js
2016-10-26 10:43:11 +02:00

17 lines
384 B
JavaScript

'use strict';
const BPromise = require('bluebird');
const ValidationError = require('./ValidationError');
function validateRequest (req) {
return new BPromise((resolve, reject) => {
if (req.validationErrors()) {
reject(new ValidationError('Invalid syntax'));
} else {
resolve(req);
}
});
}
module.exports = validateRequest;