middleware.basic.js
This file
Path
test/middleware.basic.js
41 lines · 1.0 KiB · JavaScript
Last changed by
Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99
History of this fileTake it
The walk stopped after 200 commits: lines older than 9019424 point at it.
deps: depd@0.4.2Douglas Christopher Wilsonbefore adoption9019424
line 1why, one step back1Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99
line 2why, one step back2var assert = require('assert')deps: depd@0.4.2Douglas Christopher Wilsonbefore adoption9019424
lines 3–31why, one step back3var express = require('../');4var request = require('supertest');56describe('middleware', function(){7 describe('.next()', function(){8 it('should behave like connect', function(done){9 var app = express()10 , calls = [];1112 app.use(function(req, res, next){13 calls.push('one');14 next();15 });1617 app.use(function(req, res, next){18 calls.push('two');19 next();20 });2122 app.use(function(req, res){23 var buf = '';24 res.setHeader('Content-Type', 'application/json');25 req.setEncoding('utf8');26 req.on('data', function(chunk){ buf += chunk });27 req.on('end', function(){28 res.end(buf);29 });30 });31Merge tag '4.16.2'Douglas Christopher Wilsonbefore adoption62e12fe
line 32why, one step back32 request(app)deps: depd@0.4.2Douglas Christopher Wilsonbefore adoption9019424
lines 33–35why, one step back33 .get('/')34 .set('Content-Type', 'application/json')35 .send('{"foo":"bar"}')Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6
line 36why, one step back36 .expect('Content-Type', 'application/json')Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99
line 37why, one step back37 .expect(function () { assert.deepEqual(calls, ['one', 'two']) })Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6
line 38why, one step back38 .expect(200, '{"foo":"bar"}', done)deps: depd@0.4.2Douglas Christopher Wilsonbefore adoption9019424
lines 39–41why, one step back39 })40 })41})