req.acceptsEncodings.js
This file
Path
test/req.acceptsEncodings.js
39 lines · 953 bytes · 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 af341b0 point at it.
Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
line 1why, one step back1'use strict'deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 2–7why, one step back23var express = require('../')4 , request = require('supertest');56describe('req', function(){7 describe('.acceptsEncodings', function () {Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
line 8why, one step back8 it('should return encoding if accepted', function (done) {deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 9–10why, one step back9 var app = express();10Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 11–16why, one step back11 app.get('/', function (req, res) {12 res.send({13 gzip: req.acceptsEncodings('gzip'),14 deflate: req.acceptsEncodings('deflate')15 })16 })deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 17–18why, one step back1718 request(app)Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 19–21why, one step back19 .get('/')20 .set('Accept-Encoding', ' gzip, deflate')21 .expect(200, { gzip: 'gzip', deflate: 'deflate' }, done)deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 22–26why, one step back22 })2324 it('should be false if encoding not accepted', function(done){25 var app = express();26Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 27–31why, one step back27 app.get('/', function (req, res) {28 res.send({29 bogus: req.acceptsEncodings('bogus')30 })31 })deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 32–33why, one step back3233 request(app)Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b
lines 34–36why, one step back34 .get('/')35 .set('Accept-Encoding', ' gzip, deflate')36 .expect(200, { bogus: false }, done)deps: body-parser@2.0.0-beta.1Douglas Christopher Wilsonbefore adoptionaf341b0
lines 37–39why, one step back37 })38 })39})