deps: path-to-regexp@0.1.6
Before adoption: this commit came in with the history the project adopted, so no landing records it.
fixes #2491 fixes #2617 closes #2637 closes #2683
authored by Blake Embrey · committed by Douglas Christopher Wilson · parent e66bb4f · Browse files · 4 files·+49 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+49 added−12 removed
- tests:+41 added−0 removed
- other:+8 added−12 removed
Provenance
- Commit
60e2008- Tree
fd083f9- Author
Blake Embrey <hello@blakeembrey.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
e66bb4f
4 files changed+49 added−12 removed
modified:lib/router/layer.js+4 added-10 removed
131 unmodified linesExpand all13213313413513613713813913614114214314414514613713813914014114214314426 unmodified lines131 unmodified linesExpand all this.path = m[0];
var keys = this.keys; var params = this.params; var prop; var n = 0; var key; var val;
for (var i = 1, len = m.length; i < len; ++i) { key = keys[i - 1]; prop = key ? key.name : n++; val = decode_param(m[i]); for (var i = 1; i < m.length; i++) { var key = keys[i - 1]; var prop = key.name; var val = decode_param(m[i]);
if (val !== undefined || !(hasOwnProperty.call(params, prop))) { params[prop] = val; }26 unmodified linesmodified:test/app.router.js+41 added
639 unmodified lines640 request(app)641 .get('/file')642 .expect(404, done);643 })644+645+ it('should keep correct parameter indexes', function(done){646+ var app = express();647+648+ app.get('/*/user/:id', function (req, res) {649+ res.send(req.params);650+ });651+652+ request(app)653+ .get('/1/user/2')654+ .expect(200, '{"0":"1","id":"2"}', done);655+ })656+657+ it('should work within arrays', function(done){658+ var app = express();659+660+ app.get(['/user/:id', '/foo/*', '/:bar'], function (req, res) {661+ res.send(req.params.bar);662+ });663+664+ request(app)665+ .get('/test')666+ .expect(200, 'test', done);667+ })668 })669 670 describe(':name', function(){671 it('should denote a capture group', function(done){31 unmodified lines703 .get('/user/tj/edit')704 .expect('editing tj', done);705 })706 707+ it('should work following a partial capture group', function(done){708+ var app = express();709+ var cb = after(2, done);710+711+ app.get('/user(s)?/:user/:op', function(req, res){712+ res.end(req.params.op + 'ing ' + req.params.user + (req.params[0] ? ' (old)' : ''));713+ });714+715+ request(app)716+ .get('/user/tj/edit')717+ .expect('editing tj', cb);718+719+ request(app)720+ .get('/users/tj/edit')721+ .expect('editing tj (old)', cb);722+ })723+724 it('should work in array of paths', function(done){725 var app = express();726 var cb = after(2, done);727 259 unmodified linesmodified:History.md+3 added-1 removed
1 unmodified line2 ==========3 4 * Fix `res.format` error when only `default` provided5 * Fix issue where `next('route')` in `app.param` would incorrectly skip values6+ * Fix using `*` before params in routes7+ * Fix using capture groups before params in routes8 * Use `array-flatten` module for flattening arrays9 * deps: accepts@~1.2.910 - deps: mime-types@~2.1.111 - perf: avoid argument reassignment & argument slice25 unmodified lines37 * deps: on-finished@~2.3.038 - Add defined behavior for HTTP `CONNECT` requests39 - Add defined behavior for HTTP `Upgrade` requests40 - deps: ee-first@1.1.139- * deps: path-to-regexp@0.1.441+ * deps: path-to-regexp@0.1.642 * deps: send@0.13.043 - Allow Node.js HTTP server to set `Date` response header44 - Fix incorrectly removing `Content-Location` on 304 response45 - Improve the default redirect response headers2908 unmodified linesmodified:package.json+1 added-1 removed
41 unmodified lines42 "merge-descriptors": "1.0.0",43 "methods": "~1.1.1",44 "on-finished": "~2.3.0",45 "parseurl": "~1.3.0",46- "path-to-regexp": "0.1.4",46+ "path-to-regexp": "0.1.6",47 "proxy-addr": "~1.0.8",48 "qs": "2.4.2",49 "range-parser": "~1.0.2",50 "send": "0.13.0",41 unmodified lines