Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] The default MethodNotAllowedHandler is not spec compliant #12

Open
tebruno99 opened this issue Dec 15, 2022 · 2 comments
Open

[bug] The default MethodNotAllowedHandler is not spec compliant #12

tebruno99 opened this issue Dec 15, 2022 · 2 comments
Labels
bug Something isn't working stale

Comments

@tebruno99
Copy link

tebruno99 commented Dec 15, 2022

MIGRATED
From mux created by rocketspacer: gorilla#554

RFC 7231 Section 6.5.5

States that

The origin server MUST generate an
Allow header field in a 405 response containing a list of the target
resource's currently supported methods.

Which is clearly not implemented right now
https://github.com/gorilla/mux/blob/75dcda0896e109a2a22c9315bca3bb21b87b2ba5/mux.go#L601-L603

Suggestion:

  • Rather than assign a default MethodNotAllowedHandler just reuse the NotFoundHandler so it's both backward compatible and spec-compliant.
@tebruno99 tebruno99 added bug Something isn't working stale labels Dec 15, 2022
@tebruno99
Copy link
Author

@elithrar Would you prefer a flag to skip handling MethodNotAllowed or removing the default MethodNotAllowed handler altogether? (meaning: MethodNotAllowed will only be handled if the handler is explicitly specified)

Or even something like ExplicitMethodNotAllowedHandler to flag the 2nd proposal.

@tebruno99
Copy link
Author

See comments in gorilla#555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant