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

Set Allow header when returning 405 Method Not Allowed #733

Merged
merged 1 commit into from
Jan 30, 2022

Conversation

davidpdrsn
Copy link
Member

This changes MethodRouter so it sets the Allow header when returning 405 Method Not Allowed.

The header value is built up as a BytesMut to avoid allocations when creating the response.

The header is also set when the fallback is hit, unless the response generated by the fallback already contains the header. This should result in it doing the thing most of the time while allowing users to override it if they handle additional methods in the fallback.

Fixes #731

@davidpdrsn davidpdrsn enabled auto-merge (squash) January 30, 2022 17:21
@davidpdrsn davidpdrsn merged commit 513766b into main Jan 30, 2022
@davidpdrsn davidpdrsn deleted the set-allow-header branch January 30, 2022 20:41
davidpdrsn added a commit that referenced this pull request Jan 31, 2022
davidpdrsn added a commit that referenced this pull request Feb 22, 2022
davidpdrsn added a commit that referenced this pull request Feb 22, 2022
davidpdrsn pushed a commit that referenced this pull request Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing allow header in 405 Method Not Allowed replies
2 participants