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
Describe the bug
If I define two routes with the same path content, but with different Method, then go-zero always returns 405 Method Not Allowed for one method. As we know, for a resource, we should support GET, PUT, even HEAD method on the same resource. We should not expect 405 error unless the method is not in the list(Head, Get, Put, Patch, Post...).
To Reproduce
Steps to reproduce the behavior, if applicable:
Describe the bug
If I define two routes with the same path content, but with different Method, then go-zero always returns 405 Method Not Allowed for one method. As we know, for a resource, we should support GET, PUT, even HEAD method on the same resource. We should not expect 405 error unless the method is not in the list(Head, Get, Put, Patch, Post...).
To Reproduce
Steps to reproduce the behavior, if applicable:
The code is
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodHead,
Path: "/subscriptions/:ID/groups/:groupName",
Handler: HeadGroupHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/subscriptions/:ID/groups/:groupName",
Handler: GetGroupHandler(serverCtx),
},
The error is
PUT https://xxxx.com/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/groups/test-group\n--------------------------------------------------------------------------------\nRESPONSE 405: 405 Method Not Allowed\nERROR CODE
Expected behavior
Should not return 405 error.
Screenshots
If applicable, add screenshots to help explain your problem.
Environments (please complete the following information):
Linux
More description
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: