Skip to content

"named prefix" should be enforced as a prefix, or should work in the middle of a path #53

@Dr-Emann

Description

@Dr-Emann

Example code:

local Router = require "radix-router"
local router, err = Router.new({
  {
    paths = { "/Accounts/{*middle}/Messages.json" },
    handler = "1"
  }
})
if not router then
  error("failed to create router: " .. err)
end

assert(nil == router:match("/Accounts/", { method = "POST" }))
assert("1" == router:match("/Accounts/abc/123/Messages.json", { method = "POST" }))

This will error on any attempt to match against paths under /Accounts/

Expected Behavior

I expected either:

  1. Both matches run without erroring, and asserts succeed
  2. The router fails to create because the path pattern was invalid

Actual Behavior

Errors in router:match with

radix-router.lua:129: attempt to index local 'routes' (a nil value)
radix-router.lua:197: in function 'match'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions