question: group middleware adds NotFoundHandler to prefix
and prefix*
, but it works without it anyway
#2256
Closed
3 tasks done
Issue Description
Hello team!
I have a question about the implementation detail of the echo. When I try to use an
echo.Group
with middleware, I found that there were several extra paths withNotFoundHandler
handlers that had been registered.Why is it implemented like this? I have the assumption that it could be removed. I find really confusing to have these
prefix
andprefix*
when I call Echo.RoutesIf we look at the
ServeHTTP
function, then in the case of an unknown pathNotFoundHandler
will be executed anyway due to a value in the handler field.I rectified a little a file
group.go
locally and unknown paths still return the correct 404.Checklist
Expected behavior
routes in the logs if we remove
Actual behavior
routes in the logs:
Steps to reproduce
With help of the command
go mod vendor
I changed the group.go file https://github.com/labstack/echo/blob/master/group.go#L28to
then
in the first terminal execute the code below
In the second terminal send the curl requests
and
curl localhost:9999/group/three
returns the correct response with 200 OK.Working code to debug
Version/commit
I tried to play with the version
github.com/labstack/echo/v4 v4.8.0
The text was updated successfully, but these errors were encountered: