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-06-18 21:55:46 +02:00

16 lines
380 B
JavaScript

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