req.acceptedEncodings.js
This file
Path
test/req.acceptedEncodings.js
36 lines · 847 bytes · JavaScript
Last changed by
add req.acceptedEncodingsTJ Holowaychukbefore adoption3b1597d
History of this fileTake it
add req.acceptedEncodingsTJ Holowaychukbefore adoption3b1597d
lines 1–36why, one step back12var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.acceptedEncodings', function(){7 it('should return an array of accepted encodings', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptedEncodings.should.eql(['gzip', 'deflate']);12 res.end();13 });1415 request(app)16 .get('/')17 .set('Accept-Encoding', ' gzip, deflate')18 .expect(200, done);19 })2021 describe('when Accept-Encoding is not present', function(){22 it('should default to []', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptedEncodings.should.have.length(0);27 res.end();28 });2930 request(app)31 .get('/')32 .expect(200, done);33 })34 })35 })36})