Message validator has the issue of calling the provided callback twice. It can cause error where it is assumed that function will be called once. For example:
var v = new MessageValidator('someurl');
function middleware(req, res, next) {
v.validate(validMessage, function(err, message) {
console.count('called');
if (err) {
return next(new Error('Validation error:' + err.message ));
}
// some code
throw new Error('inside callback');
});
}