var express = require('express'),
    expressValidator = require('../index.js'),
    app = express.createServer();

app.use(express.bodyParser());
app.use(expressValidator);

app.post('/:urlparam', function(req, res) {
  var errors = [];
  req.onValidationError(function(msg) {
    console.log('Validation error: ' + msg);
    errors.push(msg);
  });

  req.assert('postparam', 'Invalid postparam').isInt();
  req.assert('getparam', 'Invalid getparam').isInt();
  req.assert('urlparam', 'Invalid urlparam').isAlpha();

  req.sanitize('postparam').toBoolean();

  if (errors.length) {
    res.send('There have been validation errors: ' + errors.join(', '), 500);
    return;
  }
  res.json({
    urlparam: req.param('urlparam'),
    getparam: req.param('getparam'),
    postparam: req.param('postparam')
  });
});

app.listen(8888);

@@ -338,16 +338,33 @@
 h(msg);%0A
+    return this;%0A
   %7D);%0A%0A 
@@ -401,32 +401,43 @@
 lid postparam').
+notEmpty().
 isInt();%0A  req.a

Return this in error callback to allow for assert-method-chaining, fixes #2