diff --git a/tests/GlobalMiddlewareTest.php b/tests/GlobalMiddlewareTest.php index 99fce42..996f157 100644 --- a/tests/GlobalMiddlewareTest.php +++ b/tests/GlobalMiddlewareTest.php @@ -70,6 +70,19 @@ public function testAllowAllOriginsWildcard() $this->assertEquals(204, $crawler->getStatusCode()); } + public function testOriginsWildcardIncludesNestedSubdomains() + { + $this->app['config']->set('cors.allowed_origins', ['*.laravel.com']); + + $crawler = $this->call('OPTIONS', 'api/ping', [], [], [], [ + 'HTTP_ORIGIN' => 'http://api.service.test.laravel.com', + 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', + ]); + + $this->assertEquals('http://api.service.test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertEquals(204, $crawler->getStatusCode()); + } + public function testAllowAllOriginsWildcardNoMatch() { $this->app['config']->set('cors.allowed_origins', ['*.laravel.com']);