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

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

Swatinem commented Jul 28, 2011

Per visionmedia/express-resource#27 (comment) I pushed that special case into express.

@tj tj commented on the diff Jul 29, 2011

test/router.test.js
@@ -138,6 +138,26 @@ module.exports = {
{ body: 'Cannot GET /user/ab' });
},
+ 'test named capture group after dot': function(){
+ var app = express.createServer();
+
+ app.get('/user/:name.:format?', function(req, res){
+ res.send(req.params.name + ' - ' + (req.params.format || ''));
+ });
+
@tj

tj Jul 29, 2011

Owner

the main problem with these .format things really is the ambiguity, for example if you have "/commits/foo.bar" with an optional format ".bar" could be the format, or later ".patch" could be the format which would be expected but ".bar" could be part of the value, and unexpectedly become the format. IMO this is why people should just always use Accept instead

Member

jonathanong commented Sep 7, 2013

fixed according to the linked comment

@jonathanong jonathanong closed this Sep 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment