Skip to content
Myr

specialcase .:format routing to not include a dot in the capture group

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Arpad Borsos · committed by Tj Holowaychuk · parent c631eb4 · Browse files · 2 files+22 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+22 added−2 removed

  • tests:+20 added−0 removed
  • other:+2 added−2 removed

2 files+22 added−2 removed

modified:lib/router/route.js+2 added-2 removed
modified:test/router.test.js+20 added
136 unmodified lines
137 { url: '/user/ab' },138 { body: 'Cannot GET /user/ab' });139 },140 141 'test named capture group after dot': function(){142 var app = express.createServer();143 144 app.get('/user/:name.:format?', function(req, res){145 res.send(req.params.name + ' - ' + (req.params.format || ''));146 });147 148 assert.response(app,149 { url: '/user/foo' },150 { body: 'foo - ' });151 152 assert.response(app,153 { url: '/user/foo.json' },154 { body: 'foo - json' });155 156 assert.response(app,157 { url: '/user/foo.bar.json' },158 { body: 'foo.bar - json' });159 },160 161 'test optional * value': function(){162 var app = express.createServer();163 164 app.get('/admin*', function(req, res){
287 unmodified lines