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
If you add a route that includes a named variable and requires a specific HTTP method parameter, then requests that don't match will return a 405 instead of a 404 (even though the request did use the correct HTTP method, it just requested an invalid URL)
Repro
require'rubygems'require'http_router'router=HttpRouter.new.tapdo |router|
router.add("/bar/:id").to(lambda{ |env| [200,{},["Hi"]]})router.get("/foo/:id").to(lambda{ |env| [200,{},["Hi"]]})end# Just to show that it will 404 if the HTTP method is not specified aboveresponse=router.call({'SERVER_NAME'=>'localhost','SERVER_PORT'=>80,'REQUEST_METHOD'=>'GET','PATH_INFO'=>'/bar/ab/123213',})putsresponse.first# Actual: 404, Expected: 404.# And now for the incorrect case ... response=router.call({'SERVER_NAME'=>'localhost','SERVER_PORT'=>80,'REQUEST_METHOD'=>'GET','PATH_INFO'=>'/foo/ab/1234/asdfasfasdf',})putsresponse.first# Actual: 405, Expected: 404.
The text was updated successfully, but these errors were encountered:
If you add a route that includes a named variable and requires a specific HTTP method parameter, then requests that don't match will return a 405 instead of a 404 (even though the request did use the correct HTTP method, it just requested an invalid URL)
Repro
The text was updated successfully, but these errors were encountered: