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
When I use the subrouter() method, Methods() only works on the last endpoint, and other than the last endpoint, the rest of the endpoints give a 404 instead of a 405 with the unrelated http method.
#751
Open
1 task done
iarsham opened this issue
Feb 6, 2024
· 3 comments
When I use the subrouter() method, Methods() only works on the last endpoint, and other than the last endpoint, the rest of the endpoints give a 404 instead of a 405 with the unrelated http method.
last endpoint :
other endpoints:
Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
This appears to have been broken by #712, which clears a 405 error when a subsequent route matches in any part. The logic here is tricky: the desire is that if
Route 1: POST "/users/{id}".
Route 2: GET "/users/{id}", parameters: "id": "[0-9]+".
are configured, then GET "/users/-2" returns a 404, not a 405, because while it matches route 1 with a method error, it is a "better" match to route 2 with a parameter validation error.
But this logic then also applies to prefix matching in a sub router: the prefix match is the first matcher in the sequence, and a subsequent route that matches the prefix but is otherwise clearly not a match will clear an existing 405. Unfortunately I don't know the mux internals well enough to suggest a fix, but it seems like if the check from #712 is desired, it shouldn't apply to subroute matchers.
Open issue gorilla/mux#751 (2024-02-06)
causes router to return 404 instead of 405 when the path matches but
method does not.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <[email protected]>
Is there an existing issue for this?
Current Behavior
When I use the subrouter() method, Methods() only works on the last endpoint, and other than the last endpoint, the rest of the endpoints give a 404 instead of a 405 with the unrelated http method.
last endpoint :
other endpoints:
Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: