req.acceptsEncodings.js
This file
Path
test/req.acceptsEncodings.js
39 lines · 953 bytes · JavaScript
Last changed by
tests: fix req.acceptsEncodings testsDouglas Christopher Wilsonbefore adoption8ee3420
History of this fileTake it
12345678910111213141516171819202122232425262728293031323334353637383940'use strict'
var express = require('../') , request = require('supertest');
describe('req', function(){ describe('.acceptsEncodings', function () { it('should return encoding if accepted', function (done) { var app = express();
app.get('/', function (req, res) { res.send({ gzip: req.acceptsEncodings('gzip'), deflate: req.acceptsEncodings('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.acceptsEncodings('bogus') }) })
request(app) .get('/') .set('Accept-Encoding', ' gzip, deflate') .expect(200, { bogus: false }, done) }) })})