Skip to content
Myr

req.param.js

This file

Path

test/req.param.js

60 lines · 1.2 KiB · 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 6aaa7dc point at it.

Added + support to the routerTJ Holowaychukbefore adoption6aaa7dc

lines 1–15why, one step back
1
2var express = require('../')3 , request = require('./support/http');45describe('req', function(){6 describe('.param(name, default)', function(){7 it('should use the default value unless defined', function(done){8 var app = express();910 app.use(function(req, res){11 res.end(req.param('name', 'tj'));12 });1314 request(app)15 .get('/')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

line 16why, one step back
16 .expect('tj', done);

Added + support to the routerTJ Holowaychukbefore adoption6aaa7dc

lines 17–29why, one step back
17 })
18 })1920 describe('.param(name)', function(){21 it('should check req.query', function(done){22 var app = express();2324 app.use(function(req, res){25 res.end(req.param('name'));26 });2728 request(app)29 .get('/?name=tj')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

line 30why, one step back
30 .expect('tj', done);

Added + support to the routerTJ Holowaychukbefore adoption6aaa7dc

lines 31–43why, one step back
31 })
32 33 it('should check req.body', function(done){34 var app = express();3536 app.use(express.bodyParser());3738 app.use(function(req, res){39 res.end(req.param('name'));40 });4142 request(app)43 .post('/')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

lines 44–45why, one step back
44 .send({ name: 'tj' })
45 .expect('tj', done);

Added + support to the routerTJ Holowaychukbefore adoption6aaa7dc

lines 46–56why, one step back
46 })
47 48 it('should check req.params', function(done){49 var app = express();5051 app.get('/user/:name', function(req, res){52 res.end(req.param('filter') + req.param('name'));53 });5455 request(app)56 .get('/user/tj')

updated tests to use "supertest"TJ Holowaychukbefore adoption0f5560e

line 57why, one step back
57 .expect('undefinedtj', done);

Added + support to the routerTJ Holowaychukbefore adoption6aaa7dc

lines 58–60why, one step back
58 })
59 })60})