Commit cdb8e6b
committed
fix(router): walk parent tree for RouteNotFound handler in groups
When a route exists in the router but the HTTP method is not allowed,
the router previously always fell back to methodNotAllowedHandler.
However, this bypassed any RouteNotFound handler registered at a parent
or root level, which is the expected behavior when using echo.Group().
This fix traverses the parent node chain to look for a notFoundHandler,
allowing RouteNotFound middleware defined at a higher group level to
properly handle 404-like responses for sub-groups.
Fixes #2485
Signed-off-by: lyydsheep <2230561977@qq.com>1 parent ec05bc8 commit cdb8e6b
1 file changed
+21
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
1014 | | - | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
1015 | 1027 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
1020 | 1036 | | |
1021 | 1037 | | |
1022 | 1038 | | |
| |||
0 commit comments