Using Sinatra routes, there can be either a required named parameter or an optional named parameter in the same part of the route.
The optional route parameter works fine here
get '/widgets.?:format?'
But try to combine the required named parameter and everything will break.
get '/widgets/:id.?:format?'
Requests for /widgets/abc.json pass the entire abc.json file as an id parameter.
Sinatra compiled regex:
/^\/widgets\/([^\/?
Ryanw source
share