echo
echo copied to clipboard
Different handlers for the same endpoint without problems.
Issue Description
Different handlers can be executed for the same end point without problems.
example:
func main() {
router := echo.New()
group := router.Group("/api")
group.GET("/:user", handler1)
router.GET("/api/:user", handler2)
router.Start(":8080")
}
func handler1(c echo.Context) error {
user := c.Param("user")
return c.String(http.StatusOK, user)
}
func handler2(c echo.Context) error {
user := c.Param("user")
return c.String(http.StatusOK, user)
}
Actually, It is running handler2
handler on /api/:user
. But, this case isn't developer-friendly.
If echo engine warn or error above case, developer can notice unexpected behavior like this.
same #1726 ?
Checklist
- [x] Dependencies installed
- [x] No typos
- [x] Searched existing issues and docs
Version/commit
echo: v4.7.2
I can not comment if it was intended but last N years you have been able to overwrite routes with new handlers. This is what is happening. It is a "feature" of Echo :)
@aldas Thanks comment, I got it.