req.acceptsEncoding.js
This file
Path
test/req.acceptsEncoding.js
38 lines · 934 bytes · JavaScript
Last changed by
tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839
var express = require('../') , request = require('supertest');
describe('req', function(){ describe('.acceptsEncoding', function(){ it('should return encoding if accepted', function (done) { var app = express();
app.get('/', function (req, res) { res.send({ gzip: req.acceptsEncoding('gzip'), deflate: req.acceptsEncoding('deflate') }) })
request(app) .get('/') .set('Accept-Encoding', ' gzip, deflate') .expect(200, { gzip: 'gzip', deflate: 'deflate' }, done) })
it('should be false if encoding not accepted', function(done){ var app = express();
app.get('/', function (req, res) { res.send({ bogus: req.acceptsEncoding('bogus') }) })
request(app) .get('/') .set('Accept-Encoding', ' gzip, deflate') .expect(200, { bogus: false }, done) }) })})