3 var assert = require('assert')
4 var express = require('../');
5 var request = require('supertest');
7 describe('middleware', function(){
8 describe('.next()', function(){
9 it('should behave like connect', function(done){
13 app.use(function(req, res, next){
18 app.use(function(req, res, next){
23 app.use(function(req, res){
25 res.setHeader('Content-Type', 'application/json');
26 req.setEncoding('utf8');
27 req.on('data', function(chunk){ buf += chunk });
28 req.on('end', function(){
35 .set('Content-Type', 'application/json')
36 .send('{"foo":"bar"}')
37 .expect('Content-Type', 'application/json')
38 .expect(function () { assert.deepEqual(calls, ['one', 'two']) })
39 .expect(200, '{"foo":"bar"}', done)