Skip to content
Myr

req.get.js

This file

Path

test/req.get.js

35 lines · 836 bytes · JavaScript

Last changed by

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

History of this file

Take it

The walk stopped after 200 commits: lines older than 7294806 point at it.

try npm publishConfigTJ Holowaychukbefore adoption7294806

lines 1–2why, one step back
1
2var express = require('../')

assertion for req.get() => undefined. Closes #1152TJ Holowaychukbefore adoption685eec0

lines 3–4why, one step back
3 , request = require('./support/http')
4 , assert = require('assert');

try npm publishConfigTJ Holowaychukbefore adoption7294806

lines 5–11why, one step back
5
6describe('req', function(){7 describe('.get(field)', function(){8 it('should return the header field value', function(done){9 var app = express();1011 app.use(function(req, res){

assertion for req.get() => undefined. Closes #1152TJ Holowaychukbefore adoption685eec0

line 12why, one step back
12 assert(req.get('Something-Else') === undefined);

try npm publishConfigTJ Holowaychukbefore adoption7294806

lines 13–18why, one step back
13 res.end(req.get('Content-Type'));
14 });1516 request(app)17 .post('/')18 .set('Content-Type', 'application/json')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

line 19why, one step back
19 .expect('application/json', done);

try npm publishConfigTJ Holowaychukbefore adoption7294806

lines 20–31why, one step back
20 })
2122 it('should special-case Referer', function(done){23 var app = express();2425 app.use(function(req, res){26 res.end(req.get('Referer'));27 });2829 request(app)30 .post('/')31 .set('Referrer', 'http://foobar.com')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

line 32why, one step back
32 .expect('http://foobar.com', done);

try npm publishConfigTJ Holowaychukbefore adoption7294806

lines 33–35why, one step back
33 })
34 })35})