-
-
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
Wrong parameter behaviour with specific path #1744
Comments
Seems to be same as #479 Problem is that routes with same path (with path variables at same location) but with different method are grouped by path. Parameter name comes from firstly declared route that created routing node. Subsequent route declarations just add their method on that node but dont register their parameter names for the same place. So route for path Line 204 in 6119aec
so probably when method handler is added to Node we could add pNames also for that method (pull pnames down from node to near method handlers Line 32 in 6119aec
then every method on same router Node can have different name for parameter name at same place when match is made and we populate context with pnames/pvalues. Anyway @lammel and @pafuent should know that subject better. |
This is currently not supported. You have to use consistent parameter naming for routes. The solution suggested by @aldas is one of the options, also a refactoring of the router to decouple routes and method handlers is an option. |
Duplicate of #1726 |
From now, Echo panics if a route that was already added, is added again but for a different HTTP method and the path params are different. e.g. GET /translation/:lang -> Added OK PUT /translation/:lang -> Added OK DELETE /translation/:id -> Panic Partially Fixes labstack#1726 labstack#1744
Issue Description
Route
router.DELETE
takes parameters fromrouter.GET
instead of his own parameters.Checklist
Expected behaviour
DeleteTranslation handler receives echo.Context with id parameter without lang parameter
Actual behaviour
DeleteTranslation handler receives lang parameter instead of id parameter
Steps to reproduce
DELETE http://localhost:3333/translation/123
Working code to debug
Version/commit
go 1.15
github.com/labstack/echo/v4 v4.1.17
The text was updated successfully, but these errors were encountered: