From d73f66b5e42dccb869b8dcc3c41c1833973007c2 Mon Sep 17 00:00:00 2001 From: Virgil Date: Wed, 6 Aug 2014 12:38:00 +0300 Subject: [PATCH] Avoid "No route found for OPTIONS" errors To [short circuit the Silex controller](http://silex.sensiolabs.org/doc/middlewares.html#short-circuiting-the-controller) we must return a Response and it seems calling $response->send() alone is not enough as it is generating an MethodNotAllowedHttpException. The change proposed avoid these exceptions. --- src/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.php b/src/app.php index dea0fac..88db28f 100755 --- a/src/app.php +++ b/src/app.php @@ -24,7 +24,7 @@ $response->headers->set("Access-Control-Allow-Methods","GET,POST,PUT,DELETE,OPTIONS"); $response->headers->set("Access-Control-Allow-Headers","Content-Type"); $response->setStatusCode(200); - $response->send(); + return $response->send(); } }, Application::EARLY_EVENT);