slimphp / Slim-Skeleton

Slim Framework 4 Skeleton Application
http://www.slimframework.com
MIT License
1.59k stars 479 forks source link

Add a route to catch "404 Not Found" errors #214

Closed AntoninoM90 closed 3 years ago

l0gicgate commented 3 years ago

There is no need for this. Slim throws HttpNotFoundException if no route is matched when routing has been performed.

eugene-borovov commented 3 years ago

CORS Pre-Flight route break Slim default behavior. Now you get 405 Method not allowed. Must be one of: OPTIONS instead of 404 Not found if no route is matched.

carlosmintfan commented 5 months ago

@AntoninoM90 I guess @l0gicgate didn't think about that behaviour which @eugene-borovov explained, you could make a new PR. But I'm also not very sure about this catch either because then you'd get 404 instead of 405 for other routes where you really should get 405. So I think I'd make some checking and open a new PR here and for the docs which checks if it return 404 or 405 depending on if the allowed route is OPTIONS or something else.