diff --git a/src/Cors.php b/src/Cors.php index cd0b83c..7f54c9f 100644 --- a/src/Cors.php +++ b/src/Cors.php @@ -45,10 +45,6 @@ public function __construct(HttpKernelInterface $app, array $options = array()) public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) { - if (!$this->cors->isCorsRequest($request)) { - return $this->app->handle($request, $type, $catch); - } - if ($this->cors->isPreflightRequest($request)) { return $this->cors->handlePreflightRequest($request); } diff --git a/tests/CorsTest.php b/tests/CorsTest.php index b79cf91..2996287 100644 --- a/tests/CorsTest.php +++ b/tests/CorsTest.php @@ -22,21 +22,20 @@ class CorsTest extends TestCase /** * @test */ - public function it_does_not_modify_on_a_request_without_origin() + public function it_does_modify_on_a_request_without_origin() { $app = $this->createStackedApp(); $unmodifiedResponse = new Response(); $response = $app->handle(new Request()); - $this->assertEquals($unmodifiedResponse->headers, $response->headers); + $this->assertEquals('localhost', $response->headers->get('Access-Control-Allow-Origin')); } - /** * @test */ - public function it_does_not_modify_on_a_request_with_same_origin() + public function it_does_modify_on_a_request_with_same_origin() { $app = $this->createStackedApp(array('allowedOrigins' => array('*'))); $unmodifiedResponse = new Response(); @@ -45,10 +44,8 @@ public function it_does_not_modify_on_a_request_with_same_origin() $request->headers->set('Host', 'foo.com'); $request->headers->set('Origin', 'http://foo.com'); $response = $app->handle($request); - $unmodifiedResponse->headers->date = ''; - $response->headers->date = ''; - $this->assertEquals($unmodifiedResponse->headers, $response->headers); + $this->assertEquals('*', $response->headers->get('Access-Control-Allow-Origin')); } /**