Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Test nested wilcard (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
deleugpn authored Oct 1, 2020
1 parent 4b19bfc commit ea16717
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/GlobalMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit ea16717

Please sign in to comment.