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

Return 405 status code when HTTP method does not match #1171

Open
Chi-teck opened this issue Nov 29, 2024 · 0 comments
Open

Return 405 status code when HTTP method does not match #1171

Chi-teck opened this issue Nov 29, 2024 · 0 comments
Labels

Comments

@Chi-teck
Copy link

Chi-teck commented Nov 29, 2024

Description

If a path exists in the route configuration, the router shouldn’t return a 404 just because the HTTP method isn’t allowed. Instead, it should return a 405 response and include the Allow header.

Symfony router and FastRoute support this.

Code and/or config needed to reproduce the problem.

Create a route like this

[Route(route: '/example', name: 'example', methods: ['POST'])]

Send GET request to /example. Note that it returns 404, not 405, and Allow header is missing.

Q A
Framework Version 3.14
PHP version 8.3
Operating system Linux
@Chi-teck Chi-teck added the Bug label Nov 29, 2024
@Chi-teck Chi-teck changed the title Return 405 status code when HTTP method does match Return 405 status code when HTTP method does not match Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant