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
Removed `req.header(field)`TJ Holowaychukbefore adoption85d6964
lines 1–39why, one step back12var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.get(field)', function(){7 it('should return the header field value', function(done){8 var app = express();910 app.use(function(req, res){11 res.end(req.get('Content-Type'));12 });1314 request(app)15 .post('/')16 .set('Content-Type', 'application/json')17 .end(function(res){18 res.body.should.equal('application/json');19 done();20 });21 })2223 it('should special-case Referer', function(done){24 var app = express();2526 app.use(function(req, res){27 res.end(req.get('Referer'));28 });2930 request(app)31 .post('/')32 .set('Referrer', 'http://foobar.com')33 .end(function(res){34 res.body.should.equal('http://foobar.com');35 done();36 });37 })38 })39})