umerhassan's avatar

Best way to handle MethodNotAllowedHttpException

How to check or redirect if Request object is null, any general or global solution Thanks

0 likes
4 replies
Cronix's avatar

Don't hit a route using the wrong http verb? Like don't hit a get route with a post request.

umerhassan's avatar

I know but if someone do refresh page on submitted page it will also throw exception. I just want to redirect, I can check that in controller manually for each request but I am asking is there any way to handle general exceptions like in handler file or anywhere? exception I got

Symfony \ Component \ HttpKernel \ Exception \ 
MethodNotAllowedHttpException
umerhassan's avatar

I have just solved by checking in Handler.php that if $request->_token is coming null or not. Thanks @Cronix

Please or to participate in this conversation.