-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
static routing and dynamic routing conflicts problems. #1406
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
Comments
I can confirm this. I have the same issue and created some tests to reproduce it. See patch attached. I created test for route and it passes, but test for group doesn't pass (routes are the same). I have no time to properly format those tests with project's requirements to code formatting, etc (to make PR). So, who is interested, may start from applying attached patch. I printed a tree (image attached), you may see, that |
Yes, the same problem. In my case, it happened when after
because of intersections of static and dynamic routes in Even though the methods are different ( |
May be the similar problem in this example:
Test with curl:
Result: |
The main issue is that the router does not consider the request method when resolving routes. The pull request #1413 fixes detection of the longest matching any route, but does not (at least not intentional) help for overlaying methods of a route. I'm working on that issue too, as we are facing a similar problem with routing. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please don't close this issue. This is a bug and it must be fixed and verified by human being. |
Issue Description
If static routing and dynamic routing have only the last or several characters different, there will be routing conflicts.
Checklist
e.GET("/ups/person",hello)
e.GET("/users/new", hello)
e.GET("users/:name", hello)
curl localhost:1323/users/new --- ok
curl localhost:1323/users/new2 --- 404
Expected behaviour
curl localhost:1323/users/new --- ok
curl localhost:1323/users/new2 --- ok
Actual behaviour
curl localhost:1323/users/new --- ok
curl localhost:1323/users/new2 --- 404
Steps to reproduce
Working code to debug
Version/commit
The text was updated successfully, but these errors were encountered: