build: support Node.js 9.x
[express.git] / test / req.acceptsEncodings.js
blobaba8ea5fbebdfa4905f8e9c2c561c3a1a4ddee2c
2 var express = require('../')
3   , request = require('supertest');
5 describe('req', function(){
6   describe('.acceptsEncodingss', function(){
7     it('should be true if encoding accepted', function(done){
8       var app = express();
10       app.use(function(req, res){
11         req.acceptsEncodings('gzip').should.be.ok()
12         req.acceptsEncodings('deflate').should.be.ok()
13         res.end();
14       });
16       request(app)
17       .get('/')
18       .set('Accept-Encoding', ' gzip, deflate')
19       .expect(200, done);
20     })
22     it('should be false if encoding not accepted', function(done){
23       var app = express();
25       app.use(function(req, res){
26         req.acceptsEncodings('bogus').should.not.be.ok()
27         res.end();
28       });
30       request(app)
31       .get('/')
32       .set('Accept-Encoding', ' gzip, deflate')
33       .expect(200, done);
34     })
35   })