A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/sinatra/sinatra/issues/1409 below:

Sinatra::Namespace breaks route with named parameters ? · Issue #1409 · sinatra/sinatra · GitHub

Hi folks,

Running into an issue upgrading to Sinatra 2.

This route works fine without Sinatra::Namespace:

class TestController < MainController
  get '/i/love/:framework.?:format?' do
    params.to_json
  end
end
$> http --body localhost:9393/v1/i/love/sinatra

{
    "captures": [],
    "format": null,
    "framework": "sinatra"
}

$> http --body localhost:9393/v1/i/love/sinatra.json

{
    "captures": [],
    "format": "json",
    "framework": "sinatra"
}

If I try to namespace the same route with Sinatra::Namespace:

class TestController < MainController
  register Sinatra::Namespace

  namespace '/hey' do
    get '/i/love/:framework.?:format?' do
      params.to_json
    end
  end
end

It won't start:

$> bundle exec puma --port=9393 config.ru

Puma starting in single mode...
* Version 3.11.3 (ruby 2.5.0-p0), codename: Love Song
* Min threads: 2, max threads: 10
* Environment: development

! Unable to load application: Mustermann::Error: #<Class:0x00007fb6e10c22a0>: Cannot translate Mustermann::AST::Node::WithLookAhead

Here is the full trace: https://gist.github.com/scalp42/e627e470c6169e3f4be380cea327b697

Any ideas? 🤔

Thanks in advance for the help!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4