req.accepted.js
This file
Path
test/req.accepted.js
37 lines · 889 bytes · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 8ac3e80 point at it.
Merge branch 'master' of github.com:visionmedia/expressTJ Holowaychukbefore adoption8ac3e80
lines 1–37why, one step back12var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.accepted', function(){7 it('should return an array of accepted media types', function(done){8 var app = express();910 app.use(function(req, res){11 req.accepted[0].value.should.equal('application/json');12 req.accepted[1].value.should.equal('text/html');13 res.end();14 });1516 request(app)17 .get('/')18 .set('Accept', 'text/html;q=.5, application/json')19 .expect(200, done);20 })2122 describe('when Accept is not present', function(){23 it('should default to []', function(done){24 var app = express();2526 app.use(function(req, res){27 req.accepted.should.have.length(0);28 res.end();29 });3031 request(app)32 .get('/')33 .expect(200, done);34 })35 })36 })37})