Actual behavior (the bug)
When a 405 Method Not Allowed response is returned, it does not include the Allow header specifying the supported HTTP methods. This is not compliant with the HTTP specification.
Expected behavior
The response should include an Allow header listing the HTTP methods that are supported by the target resource, as required by the HTTP/1.1 specification.
To Reproduce
- Send a request to an endpoint using an unsupported HTTP method.
- Observe the response returned with status code 405.
- Check the headers — the Allow header is missing.
Additional context
According to the HTTP/1.1 specification:
The 405 (Method Not Allowed) status code indicates that the method received in the request-line is known by the origin server but not supported by the target resource. The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods.
Actual behavior (the bug)
When a 405 Method Not Allowed response is returned, it does not include the Allow header specifying the supported HTTP methods. This is not compliant with the HTTP specification.
Expected behavior
The response should include an Allow header listing the HTTP methods that are supported by the target resource, as required by the HTTP/1.1 specification.
To Reproduce
Additional context
According to the HTTP/1.1 specification: