Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 20635d0 point at it.

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

line 1why, one step back
1'use strict'

Merge tag '3.16.9'Douglas Christopher Wilsonbefore adoption20635d0

line 2why, one step back
2

fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359

line 3why, one step back
3var assert = require('node:assert')

Merge tag '3.16.9'Douglas Christopher Wilsonbefore adoption20635d0

lines 4–32why, one step back
4var 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 });32

Merge tag '4.16.2'Douglas Christopher Wilsonbefore adoption62e12fe

line 33why, one step back
33 request(app)

Merge tag '3.16.9'Douglas Christopher Wilsonbefore adoption20635d0

lines 34–36why, one step back
34 .get('/')
35 .set('Content-Type', 'application/json')36 .send('{"foo":"bar"}')

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 37why, one step back
37 .expect('Content-Type', 'application/json')

Merge tag '4.17.1'Douglas Christopher Wilsonbefore adoption121fe99

line 38why, one step back
38 .expect(function () { assert.deepEqual(calls, ['one', 'two']) })

Merge tag '4.14.0'Douglas Christopher Wilsonbefore adoption1dbfee6

line 39why, one step back
39 .expect(200, '{"foo":"bar"}', done)

Merge tag '3.16.9'Douglas Christopher Wilsonbefore adoption20635d0

lines 40–42why, one step back
40 })
41 })42})