shio-rs icon indicating copy to clipboard operation
shio-rs copied to clipboard

Router returns 404 if route exists but method does not match

Open algermissen opened this issue 8 years ago • 1 comments

When registering a route with GET /test and I send a POST request to /test, the return is 404.

It should be 405 Method Not Allowed.

algermissen avatar Oct 15 '17 13:10 algermissen

This needs to keep track of or check endpoints and all their defined methods since 405 is used to signal that the endpoint is good but the method used is not allowed (and the response should contain an Allow header). For example, read-only endpoints. 404 is used to signal an invalid endpoint. But this behavior is something that would be expected of a REST implementation. A custom router/route could apply this REST specific implementation by returning 405 for a particular endpoint and a particular method.

brokenthorn avatar Oct 02 '18 14:10 brokenthorn