API Routing broken
I've seen reports before and I couldn't believe it... and now I'm here.
Nitro-Routes:
2 concurrent routes: one for
:id/os/:resourceType
(generic handler) and one for :id/os/networks
(edge case handling). Latter only has a post-handler!
Code executed (server side):
This is a get-Request.
The edge case handler does not get called, that's correct.
The generic get handler gets called - and suddenly the resourceType
no longer exists in the event.
It should look like (after removing the edge case handler):
It really looks like (with edge handler):
The matchedRoute points to the correct path. But if it would be really using it, it must fail because there's no get-handler for that path.6 Replies
The get-entry in that handler object is wrong.
@danielroe Good morning. Before I spend time creating a repro for a bugreport... is this known?
I think the post/get are not included in the routing - so basically the route is matched first and then the method is evaluated.
so... by design? Not a bug?
I think it's definitely worth a discussion.
I think it's a limitation of how routing is implemented in nitro using radix3 (a consequence of speed/perf decisions) - but I know pooya is rethinking things for a new version of radix3, and this might be on his list
Alright, I'll open up an issue in github, with repro. The current implementation ... hurts. Badly.
Thank you ❤️