shio-rs
shio-rs copied to clipboard
Router returns 404 if route exists but method does not match
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.
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.