-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Line 549 in 7ce1722
| panic(fmt.Sprintf("add: invalid http method %s\n", method)) |
I have registered a handler in a following way:
app.Get("/bar", handler)
When I try curl -X PATCH $HOSTNAME/bar, the app returns HTTP/1.1 405 Method Not Allowed and Allow: GET, HEAD.
This is a proper response that is expected and RFC compliant.
When I try curl -X PATCH $HOSTNAME/baz, the app returns HTTP/1.1 404 Not Found.
This is a proper response that is expected and RFC compliant.
When I try curl -X FOO $HOSTNAME/bar, the app returns HTTP/1.1 400 Bad Request, no Allow header and Invalid http method as a plain-text body.
I believe that this is not a proper response. As per RFC 9110, I believe that a response with the 501 status code should be sent instead:
501 Not Implemented
The 501 (Not Implemented) status code indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.
In practice, I may also expect 405 response similar to the one to the DELETE request.
When I try curl -X FOO $HOSTNAME/baz, the app returns HTTP/1.1 400 Bad Request, no Allow header and Invalid http method as a plaintext body.
I believe that this is not a proper response. As per RFC 9110, I believe that a response with the 404 status code should be sent instead:
[404 Not Found](https://datatracker.ietf.org/doc/html/rfc9110#name-404-not-found)
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the [target resource](https://datatracker.ietf.org/doc/html/rfc9110#target.resource) or is not willing to disclose that one exists.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status