-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Group middleware does not work for "Any" route #2517
Comments
This is little bit tricky. Let assume group and handler is added like this: func main() {
e := echo.New()
g := e.Group("/api/test")
//g.Use(middleware.Logger())
g.Any("*", func(c echo.Context) error {
return c.String(http.StatusOK, c.Path())
})
if err := e.Start(":8080"); err != nil && !errors.Is(err, http.ErrServerClosed) {
e.Logger.Fatal(err)
}
} When you add route with x@x:~/code$ curl http://localhost:8080/api/test/hi
/api/test*
x@x:~/code$ curl http://localhost:8080/api/testhi
/api/test* as your router has following routes now when we add middleware to that group by uncommenting that x@x:~/code$ curl http://localhost:8080/api/testhi
/api/test*
x@x:~/code$ curl http://localhost:8080/api/test/hi
{"message":"Not Found"} As a workaround I suggest:
That 404 route is a "feature" that is added here (line 32) Lines 21 to 32 in 77d5ae6
|
Issue Description
Checklist
Expected behaviour
normal routing
Actual behaviour
{
"message": "Not Found"
}
Steps to reproduce
just create any request
Working code to debug
Version/commit
github.com/labstack/echo/v4 v4.11.1
The text was updated successfully, but these errors were encountered: