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

wants to merge 1 commit into


None yet
3 participants

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

@@ -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 Jul 29, 2011


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


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