req.acceptedEncodings.js
This file
Path
test/req.acceptedEncodings.js
37 lines · 878 bytes · JavaScript
Last changed by
remove unnecessary test/support/httpJonathan Ongbefore adoption328c6d3
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738
var express = require('../') , request = require('supertest');
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('/') .set('Accept-Encoding', '') .expect(200, done); }) }) })})