middleware.basic.js
This file
Path
test/middleware.basic.js
42 lines · 1.0 KiB · JavaScript
Last changed by
fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359
History of this fileTake it
The walk stopped after 200 commits: lines older than f4120a6 point at it.
Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
line 1why, one step back1'use strict'5.0.0-alpha.6Douglas Christopher Wilsonbefore adoptionf4120a6
line 2why, one step back2fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359
line 3why, one step back3var assert = require('node:assert')5.0.0-alpha.6Douglas Christopher Wilsonbefore adoptionf4120a6
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)5.0.0-alpha.6Douglas Christopher Wilsonbefore adoptionf4120a6
lines 34–37why, one step back34 .get('/')35 .set('Content-Type', 'application/json')36 .send('{"foo":"bar"}')37 .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']) })5.0.0-alpha.6Douglas Christopher Wilsonbefore adoptionf4120a6
lines 39–42why, one step back39 .expect(200, '{"foo":"bar"}', done)40 })41 })42})