req.get.js
This file
Path
test/req.get.js
39 lines · 872 bytes · JavaScript
Last changed by
Removed `req.header(field)`TJ Holowaychukbefore adoption85d6964
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839
var express = require('../') , request = require('./support/http');
describe('req', function(){ describe('.get(field)', function(){ it('should return the header field value', function(done){ var app = express();
app.use(function(req, res){ res.end(req.get('Content-Type')); });
request(app) .post('/') .set('Content-Type', 'application/json') .end(function(res){ res.body.should.equal('application/json'); done(); }); })
it('should special-case Referer', function(done){ var app = express();
app.use(function(req, res){ res.end(req.get('Referer')); });
request(app) .post('/') .set('Referrer', 'http://foobar.com') .end(function(res){ res.body.should.equal('http://foobar.com'); done(); }); }) })})