Sinatra Namespace and sinatra.route #1927
-
Hi, I found this issue where the require 'sinatra'
namespace '/foo/:foo_id' do
get '/bar/:bar_id' do
p env['sinatra.route'] # will print GET /foo/{foo_id}/bar/{bar_id}
end
end
get '/foo/:foo_id/baz/:baz_id' do
p env['sinatra.route'] # will print GET /foo/:foo_id/baz/:baz_id
end Is there a way to config the namespace s.t it won't affect the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't think you can configure anything so this wont happen... but that is just my hunch, I haven't looked into the code. Do you want to investigate it @ddanurwenda? |
Beta Was this translation helpful? Give feedback.
-
A quick investigation tells me it's the default behavior of mustermann when concatenating two sinatra patterns (with colon) that results one with curly braces. https://github.com/sinatra/mustermann/blob/377855be0297025752f024601d4eed33389aed40/mustermann/spec/concat_spec.rb#L7-L11. |
Beta Was this translation helpful? Give feedback.
A quick investigation tells me it's the default behavior of mustermann when concatenating two sinatra patterns (with colon) that results one with curly braces. https://github.com/sinatra/mustermann/blob/377855be0297025752f024601d4eed33389aed40/mustermann/spec/concat_spec.rb#L7-L11.