Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building URLs with globbed routing #1926

Open
jwoertink opened this issue Oct 30, 2024 · 3 comments
Open

Building URLs with globbed routing #1926

jwoertink opened this issue Oct 30, 2024 · 3 comments

Comments

@jwoertink
Copy link
Member

I'm pretty sure this isn't possible at the moment, or maybe I'm just missing it, but I don't believe there's a way currently to build a URL from an action with globbed routing.

class Reporting::Index < BrowserAction
  get "/reporting/*:filter" do
    plain_text filter
  end
end

# Writing in a spec 
client = ApiClient.new
# there's no way to set that filter
response = client.exec(Reporting::Index.with("???"))
@robacarp
Copy link
Contributor

There was a whole discussion about this ... what ... 5 years ago? (😱)

Amber has this in amber-router, but it's a surprisingly complicated problem to solve with speed. https://github.com/amberframework/amber-router/blob/master/spec/amber_router/route_set/matching/glob_matching_spec.cr

@jwoertink
Copy link
Member Author

I may have worded the issue weird. Lucky supports glob routing already. The issue is if you want to construct the route in a spec, there's not a way to do that from the action class. Currently you have to do client.get("/the/path").

@robacarp
Copy link
Contributor

Ohhhh my mistake sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants