You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A request sent to an existing resource without an handler for that method should return http 405.
If I understand correctly this should be the behaviour in
// Check if method is supported by chi
method, ok := methodMap[r.Method]
if !ok {
methodNotAllowedHandler(ctx, w, r)
return
}
but I am getting always an http 404 error.
methodMap is initialized at startup and a method will be always found in the map, after that an handler will not be found and we finish in the handler not found case.
Maybe this control has been implemented to manage unexpected http methods that the router will not be able to handle in every case. Am I right?
The text was updated successfully, but these errors were encountered:
@mrcpvn yea, with 404, it lets you mount the NotFound() handler and response to the user. I'm open to just returning a 405, but then theres no control to the app developer here. I'll think about this some more for chi v2
I closed the issue because the same feature can be created with a middleware.
From my point of view this is not a bug if the methodNotAllowedHandler is used to handle an http method that is not expected from the chi.Router.
A request sent to an existing resource without an handler for that method should return http 405.
If I understand correctly this should be the behaviour in
but I am getting always an http 404 error.
methodMap is initialized at startup and a method will be always found in the map, after that an handler will not be found and we finish in the handler not found case.
Maybe this control has been implemented to manage unexpected http methods that the router will not be able to handle in every case. Am I right?
The text was updated successfully, but these errors were encountered: