Skip to content

Update path-to-regexp to 1.0.3 #2530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ app.get('/', function(req, res){

// /files/* is accessed via req.params[0]
// but here we name it :file
app.get('/files/:file(*)', function(req, res, next){
app.get('/files/:file*', function(req, res, next){
var file = req.params.file;
var path = __dirname + '/files/' + file;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"methods": "1.1.0",
"on-finished": "~2.1.1",
"parseurl": "~1.3.0",
"path-to-regexp": "0.1.3",
"path-to-regexp": "~1.2.0",
"proxy-addr": "~1.0.3",
"qs": "2.3.2",
"range-parser": "~1.0.2",
Expand Down
24 changes: 12 additions & 12 deletions test/app.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ describe('app.router', function(){
var app = express();
var router = new express.Router({ mergeParams: true });

router.get('/*.*', function(req, res){
router.get('/(.*).(.*)', function(req, res){
var keys = Object.keys(req.params).sort();
res.send(keys.map(function(k){ return [k, req.params[k]] }));
});
Expand All @@ -308,7 +308,7 @@ describe('app.router', function(){
var app = express();
var router = new express.Router({ mergeParams: true });

router.get('/*', function(req, res){
router.get('/(.*)', function(req, res){
var keys = Object.keys(req.params).sort();
res.send(keys.map(function(k){ return [k, req.params[k]] }));
});
Expand Down Expand Up @@ -497,7 +497,7 @@ describe('app.router', function(){
it('should allow escaped regexp', function(done){
var app = express();

app.get('/user/\\d+', function(req, res){
app.get('/user/(\\d+)', function(req, res){
res.end('woot');
});

Expand Down Expand Up @@ -530,7 +530,7 @@ describe('app.router', function(){
it('should denote a greedy capture group', function(done){
var app = express();

app.get('/user/*.json', function(req, res){
app.get('/user/(.*).json', function(req, res){
res.end(req.params[0]);
});

Expand All @@ -542,7 +542,7 @@ describe('app.router', function(){
it('should work with several', function(done){
var app = express();

app.get('/api/*.*', function(req, res){
app.get('/api/(.*).(.*)', function(req, res){
var resource = req.params[0]
, format = req.params[1];
res.end(resource + ' as ' + format);
Expand All @@ -556,7 +556,7 @@ describe('app.router', function(){
it('should work cross-segment', function(done){
var app = express();

app.get('/api*', function(req, res){
app.get('/api(.*)', function(req, res){
res.send(req.params[0]);
});

Expand All @@ -572,7 +572,7 @@ describe('app.router', function(){
it('should allow naming', function(done){
var app = express();

app.get('/api/:resource(*)', function(req, res){
app.get('/api/:resource*', function(req, res){
var resource = req.params.resource;
res.end(resource);
});
Expand Down Expand Up @@ -603,13 +603,13 @@ describe('app.router', function(){

request(app)
.get('/user/122/aaa')
.expect('122', done);
.expect('122/aaa', done);
})

it('should span multiple segments', function(done){
var app = express();

app.get('/file/*', function(req, res){
app.get('/file/(.*)', function(req, res){
res.end(req.params[0]);
});

Expand All @@ -621,7 +621,7 @@ describe('app.router', function(){
it('should be optional', function(done){
var app = express();

app.get('/file/*', function(req, res){
app.get('/file/(.*)', function(req, res){
res.end(req.params[0]);
});

Expand Down Expand Up @@ -903,7 +903,7 @@ describe('app.router', function(){
var app = express();
var path = [];

app.get('*', function(req, res, next){
app.get('/(.*)', function(req, res, next){
path.push(0);
next();
});
Expand All @@ -923,7 +923,7 @@ describe('app.router', function(){
next();
});

app.get('*', function(req, res, next){
app.get('/(.*)', function(req, res, next){
path.push(4);
next();
});
Expand Down