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
12345678910111213141516171819202122232425262728293031323334353637
var express = require('../') , request = require('./support/http');
describe('req', function(){ describe('.acceptedEncodings', function(){ it('should return an array of accepted encodings', function(done){ var app = express();
app.use(function(req, res){ req.acceptedEncodings.should.eql(['gzip', 'deflate']); res.end(); });
request(app) .get('/') .set('Accept-Encoding', ' gzip, deflate') .expect(200, done); })
describe('when Accept-Encoding is not present', function(){ it('should default to []', function(done){ var app = express();
app.use(function(req, res){ req.acceptedEncodings.should.have.length(0); res.end(); });
request(app) .get('/') .expect(200, done); }) }) })})