chi
chi copied to clipboard
Not throwing method not allowed, when I have not allowed a PUT method and have a POST method
I have a POST method using a custom middleware
`r.With(middleware.AuthMiddleware).Method(http.MethodPost, "/something", handlers.Handler(someHandler))`
and for this /something there is no other route or other method mentioned anywhere So My expectation is the chi should throw a 405 method not allowed and it seems to work for other cases, however for this POST ( originally ), hitting PUT method, it doesn't throw a 405 and just redirects to some random route.
Is there something I am missing? Or some configuration I am supposed to additionally do or remove to fix this?
Hi @SoulPancake, you need to create Custom Handler for this. You can follow this documentation https://go-chi.io/#/pages/routing?id=making-custom-404-and-405-handlers