go-chi / chi

lightweight, idiomatic and composable router for building Go HTTP services
https://go-chi.io
MIT License
18.52k stars 988 forks source link

chi.Walk missing routes #830

Open sauerbraten opened 1 year ago

sauerbraten commented 1 year ago

Similarly to https://github.com/go-chi/chi/issues/750, I'm trying to use chi.Walk() to get a report of all routes. However, I found that some routes are missing when I use Route() as well as e.g. Get() with the same pattern: https://go.dev/play/p/7Ntz1yMoXrz

Interestingly, the route is visited by the walk function when you change r.Route("/bar", ... to r.Route("/bar/", ....

Since the GET /foo/bar request is handled in both cases, I also expect chi.Walk() to report the route in both cases.

ganicus commented 1 year ago

@sauerbraten did you find out anything else about this? I'm experiencing similar issues.

sauerbraten commented 11 months ago

No, I intend to replace my chi uses with https://pkg.go.dev/net/http@master#ServeMux once Go 1.22 is released.