middleware.basic.js
This file
Path
test/middleware.basic.js
42 lines · 1.0 KiB · JavaScript
Last changed by
Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
History of this fileTake it
The walk stopped after 200 commits: lines older than e05a520 point at it.
Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
line 1why, one step back1'use strict'Merge tag '3.16.2'Douglas Christopher Wilsonbefore adoptione05a520
line 2why, one step back2Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99
line 3why, one step back3var assert = require('assert')Merge tag '3.16.2'Douglas Christopher Wilsonbefore adoptione05a520
lines 4–32why, one step back4var express = require('../');5var request = require('supertest');67describe('middleware', function(){8 describe('.next()', function(){9 it('should behave like connect', function(done){10 var app = express()11 , calls = [];1213 app.use(function(req, res, next){14 calls.push('one');15 next();16 });1718 app.use(function(req, res, next){19 calls.push('two');20 next();21 });2223 app.use(function(req, res){24 var buf = '';25 res.setHeader('Content-Type', 'application/json');26 req.setEncoding('utf8');27 req.on('data', function(chunk){ buf += chunk });28 req.on('end', function(){29 res.end(buf);30 });31 });32Merge tag '4.16.2'Douglas Christopher Wilsonbefore adoption62e12fe
line 33why, one step back33 request(app)Merge tag '3.16.2'Douglas Christopher Wilsonbefore adoptione05a520
lines 34–36why, one step back34 .get('/')35 .set('Content-Type', 'application/json')36 .send('{"foo":"bar"}')Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6
line 37why, one step back37 .expect('Content-Type', 'application/json')Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99
line 38why, one step back38 .expect(function () { assert.deepEqual(calls, ['one', 'two']) })Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6
line 39why, one step back39 .expect(200, '{"foo":"bar"}', done)Merge tag '3.16.2'Douglas Christopher Wilsonbefore adoptione05a520
lines 40–42why, one step back40 })41 })42})