req.acceptsEncoding.js
This file
Path
test/req.acceptsEncoding.js
36 lines · 850 bytes · JavaScript
Last changed by
add deprecation message to non-plural req.accepts*Douglas Christopher Wilsonbefore adoption2cccbc1
History of this fileTake it
Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061
lines 1–5why, one step back12var express = require('../')3 , request = require('supertest');45describe('req', function(){add deprecation message to non-plural req.accepts*Douglas Christopher Wilsonbefore adoption2cccbc1
line 6why, one step back6 describe('.acceptsEncoding', function(){Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061
lines 7–36why, one step back7 it('should be true if encoding accpeted', function(done){8 var app = express();910 app.use(function(req, res){11 req.acceptsEncoding('gzip').should.be.ok;12 req.acceptsEncoding('deflate').should.be.ok;13 res.end();14 });1516 request(app)17 .get('/')18 .set('Accept-Encoding', ' gzip, deflate')19 .expect(200, done);20 })2122 it('should be false if encoding not accpeted', function(done){23 var app = express();2425 app.use(function(req, res){26 req.acceptsEncoding('bogus').should.not.be.ok;27 res.end();28 });2930 request(app)31 .get('/')32 .set('Accept-Encoding', ' gzip, deflate')33 .expect(200, done);34 })35 })36})