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 status 405 when router error was ErrMethodNotAllowed #12

Open
strowk opened this issue Jan 30, 2024 · 0 comments
Open

Return status 405 when router error was ErrMethodNotAllowed #12

strowk opened this issue Jan 30, 2024 · 0 comments

Comments

@strowk
Copy link

strowk commented Jan 30, 2024

I think it could be convenient impovement here. Currently 404 is coded for all router errors.

See example how it is done in another lib:
https://github.com/getkin/kin-openapi/blob/529285c16a9d45f7f908c1d61e67abcc070d192f/openapi3filter/validation_error_encoder.go#L55-L57

Place to put it here:

case *routers.RouteError:
// We've got a bad request, the path requested doesn't match
// either server, or path, or something.
return echo.NewHTTPError(http.StatusNotFound, e.Reason)

@strowk strowk changed the title Return status 405 when router error was MethodNotAllowed Return status 405 when router error was ErrMethodNotAllowed Jan 30, 2024
florentchauveau added a commit to florentchauveau/echo-middleware that referenced this issue Jan 5, 2025
return http.StatusMethodNotAllowed when appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant