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
$ curl -X GET http://localhost:3000/test/test
GET /test/:test=test
$ curl -X PUT http://localhost:3000/test/test
PUT /test/:id=
It seems like the first added path decides what the paramter-name is. If you add another handler to the same path, the parameter-names are re-used from the first handler.
To me it seems that the parameter names are bound to the node across all http-mehtods. And this might just be correct behaviour. Do you really want different parameter-names for different http-methods?
To support different parameter-names for different http-methods, the node struct could have a map of method-params.
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.
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.
Any idea when this will be fixed? I feel this is a huge one, basically it makes it impossible to have the same routes for different methods and I end up having to create a different route for every method...
Reacted by Yasuyuki Matsumoto, Kirill Penzin, aleksej.paschenko, Aditya Kresna Permana and Evgeny Ukhanov
As I understand the problem summary is something like this:
Param names and param values are arrays
Param names are bound to route, not to route+method
Param values are getting by finding their position in ctx.pnames position.
The problem can be solved by converting echo.Node.pnames to map or structure like echo.methodHandler and filling ctx.pnames by route+method. So, it'll be not like ctx.pnames = node.pnames, but something like ctx.pnames = node.GetPnames(methodName)
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.
this is so stupid, and i hit it every couple of months. I have to google for it for 5 mins, and then the "oooh this one" moment comes. This violates the "don't do unexpected things" rule so hard.
It will be addressed in v5, currently this is hard limitation and you need to work around it i.e. do not name params differently for same path.
Naming param differently for same path seems to be situation where you are thinking/using that param conceptionally differently in another method for same path - which seems really odd to me personally. I can not think situation where different names make sense. If it is conceptionally different thing - why do you use same path? Is it not confusing for API users? For example GET /users/:idPOST /users/:name feels really really strange thing to do.
Activity
nilsmagnus commentedon Mar 21, 2019
It seems like the first added path decides what the paramter-name is. If you add another handler to the same path, the parameter-names are re-used from the first handler.
from context.go: (about line 130)
To me it seems that the parameter names are bound to the node across all http-mehtods. And this might just be correct behaviour. Do you really want different parameter-names for different http-methods?
To support different parameter-names for different http-methods, the
nodestruct could have a map of method-params.stale commentedon May 20, 2019
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.
mrLSD commentedon May 21, 2019
Any updates?
stale commentedon Jul 20, 2019
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.
supa-freak commentedon Aug 29, 2019
Any idea when this will be fixed? I feel this is a huge one, basically it makes it impossible to have the same routes for different methods and I end up having to create a different route for every method...
jerrdasur commentedon Oct 24, 2019
As I understand the problem summary is something like this:
ctx.pnamesposition.echo.Node.pnamesto map or structure likeecho.methodHandlerand fillingctx.pnamesby route+method. So, it'll be not likectx.pnames = node.pnames, but something likectx.pnames = node.GetPnames(methodName)I'll try to provide draft PR in a few days
mrLSD commentedon Oct 24, 2019
Thanks @jerrdasur
jerrdasur commentedon Oct 25, 2019
@mrLSD
You can test your case against PR above. As for me, it solves the issue with a minimum of changes.
mrLSD commentedon Oct 25, 2019
@jerrdasur Thanks for support!
For now I can't test it because can't get to my code base.
Thanks!
stale commentedon Dec 24, 2019
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.
slaveofcode commentedon Jun 21, 2020
So how the progress about this fix? It seems this PR request still unfinished and closed #1430
skast96 commentedon Feb 24, 2021
This is still a problem for us..
ddibiasi commentedon Mar 25, 2021
So this issue will be fixed in the v5 release?
hansbogert commentedon Jul 22, 2021
this is so stupid, and i hit it every couple of months. I have to google for it for 5 mins, and then the "oooh this one" moment comes. This violates the "don't do unexpected things" rule so hard.
aldas commentedon Jul 22, 2021
It will be addressed in
v5, currently this is hard limitation and you need to work around it i.e. do not name params differently for same path.Naming param differently for same path seems to be situation where you are thinking/using that param conceptionally differently in another method for same path - which seems really odd to me personally. I can not think situation where different names make sense. If it is conceptionally different thing - why do you use same path? Is it not confusing for API users? For example
GET /users/:idPOST /users/:namefeels really really strange thing to do.mrLSD commentedon Jul 26, 2021
@aldas right answer: why it doesn't work properly so long time.