You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you @nsainaney. Definitely looks like a bug. I guess this would be another reason to have our own internal Radix-tree router implementation (the other one would be Deno compatibility).
Steps to reproduce
I believe I found out what causes #670
/organizations
/organizations/:orgId/people
/organizations
,/organizations/xyz
,/organizations/xyz/people
everything works fine/organizations/xyz/people
- the request goes to/organizations/xyz
and not/organizations/xyz/people
In the radix-router,
function _findNode(path, rootNode)
loops through all the nodes in the router. In the above, the nodes tree looks like so:+-- organization
|----+-- :__id
|----+-- :orgId
|--------+-- people
When doing a lookup,
/organizations/xyz/people
, radix matches the__id
node (even though it should match:orgId/people
Expected behavior
The router should match the
:orgId/people
node and not the:__id
nodeSolutions
Create the following routes instead:
which creates a proper node tree within radix:
+-- organization
|---+-- :__id
|-------+-- people
The danger here is that :__id is undocumented and may change in the future. Is this ok? The above does not affect the REST transport, just socketio.
The text was updated successfully, but these errors were encountered: