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

more aggressive wildcards #24

Open
karlseguin opened this issue Aug 30, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@karlseguin
Copy link

commented Aug 30, 2016

I noticed that a route of:

r:match('GET', '*', ...)

doesn't match

'GET', '/'

Or, more globally, it doesn't match zero-elements.

I changed match_one_path and added the if block within the for:

local function match_one_path(node, path, f)
  for token in path:gmatch("[^/.]+") do
    node[token] = node[token] or {}
    if token == '*' and not node['LEAF'] then
      node['LEAF'] = f
    end
    node = node[token]
  end
  node["LEAF"] = f
end

All tests pass, but I'm loath to open a PR as this would probably break someone's expectations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.