title: supertest test express middleware
body: <p>found the following hint on how to test middleware in express:<br>
  <a href="https://github.com/visionmedia/express/blob/master/test/req.xhr.js" rel="noreferrer">https://github.com/visionmedia/express/blob/master/test/req.xhr.js</a><br>I was wondering why my tests were always passing. Until I noticed that when i copied the test from express they behaved the same. I tried screwing them up but they keep passing:
  <a href="https://github.com/visionmedia/express/blob/master/test/req.xhr.js" rel="noreferrer">https://github.com/visionmedia/express/blob/master/test/req.xhr.js</a><br><br>
  What am I missing here?</p>
  
  <pre><code>it('should return true when X-Requested-With is xmlhttprequest', function(done){
    var app = express();
  
    app.use(function(req, res){
      req.xhr.should.be.false; //set to false, to fail the test but it still passes
      res.end();
    });
  
    request(app)
    .get('/')
    .set('X-Requested-With', 'xmlhttprequest')
    .end(function(res){
      done();
    })
  })
  </code></pre>