You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong parameter behaviour with specific path #1744
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 /translation/: always sets parameter lang value.
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.
There were similar requests in the past though, so I guess it is time to tackle this issue.
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.
Reacted by Luan Raithz Machado, Lucas Dalmarco and cocozh
Activity
aldas commentedon Jan 1, 2021
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
/translation/:always sets parameterlangvalue.echo/router.go
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
echo/router.go
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.
lammel commentedon Jan 1, 2021
This is currently not supported. You have to use consistent parameter naming for routes.
There were similar requests in the past though, so I guess it is time to tackle this issue.
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.
lammel commentedon Jan 1, 2021
Duplicate of #1726
Panic when a route is added with different path params