1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/packages/unleash-api/lib/error/validateRequest.js
Simen Bekkhus 5aa14262a2 Fix linting errors (#145)
* Use pretty (svg) badges

* Fix build
2020-02-20 08:30:27 +01:00

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