Context#Param(name string) doesn't work in certain constellations.
The following code yields results for handler1 (using c.Param("page")) and for handler3 and handler4 (using c.Param("id"))
mux.GET("path/:page", handler1)
mux.POST("path", handler2)
mux.PATCH("path/:id", handler3)
mux.DELETE("path/:id", handler4)
The following code yields and empty string for handler3 and handler4 (using c.Param("id")).
mux.GET("path/:page", handler1)
mux.POST("path", handler2)
mux.PATCH("path/:id", handler3)
mux.DELETE("path/:id", handler4)
The following code yields and empty string for handler1 (using c.Param("page")).
mux.POST("path", handler2)
mux.PATCH("path/:id", handler3)
mux.DELETE("path/:id", handler4)
mux.GET("path/:page", handler1)
func handler3(c echo.Context) error {
idParam := c.Param("id")
log.Println(idParam);
}
See above
Latest (github.com/labstack/echo)
After reading through this issue I found that that all parameter names for the same endpoint need to be the same (which was my temporary fix).
It would certainly be advisable to mention this in the docs
I am seeing the same issue and having the workaround as @SaubereSache mentioned. However, it makes the code harder to maintain. It would be good if it can be fixed.
Revert to version 4.1.5 fix the issue in our case.
https://github.com/labstack/echo/blob/5c7c87d09e23a8943f71f3057030919fb28f1349/router.go#L302
Refer #1467 I think your issue should be fixed starting from version 4.1.13
Works, thanks for the fix :)
Regression, broke again as of v4.1.16 (@asahasrabuddhe @vishr)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is it still actual?
We ran into this bug again using v4.1.16 on one of our projects. The tests that were added as part of the merge for #1467 only test the GET and POST verbs.