Add CORS headers to the media endpoint
Squashed commit of the following: commit 0a620148dfad998f7b00804cae1db8208b23cc02 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Mar 2 15:08:36 2018 +0000 Add tests for the Cors Headers commit dd8518d279cdf3857597fa7ee6150bf383203fe1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Mar 2 15:08:20 2018 +0000 Only add Cors Headers to requests to the media endpoint commit 6c79ca5632581345ef406f211b1576a4b7f400fe Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Mar 2 15:07:53 2018 +0000 Add CorsHeaders to middleware array commit e12d48ca1e837b14b75bbd87d6197d59d60cf32e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Mar 2 15:06:32 2018 +0000 We need to send something to the OPTIONS request to the media endpoint commit f11c638be464373bff09bf015d4a989e48e61f0c Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Mar 2 15:05:45 2018 +0000 Change routes to allow for responses to an OPTIONS request to the media endpoint
This commit is contained in:
parent
e3d8b9978d
commit
c52f0e17d7
5 changed files with 75 additions and 1 deletions
34
tests/Feature/CorsHeadersTest.php
Normal file
34
tests/Feature/CorsHeadersTest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Tests\TestToken;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class CorsHeadersTest extends TestCase
|
||||
{
|
||||
use TestToken;
|
||||
|
||||
/** @test */
|
||||
public function check_cors_headers_on_media_endpoint_options_request()
|
||||
{
|
||||
$response = $this->call(
|
||||
'OPTIONS',
|
||||
'/api/media',
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
);
|
||||
$response->assertHeader('Access-Control-Allow-Origin', '*');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function check_missing_on_other_route()
|
||||
{
|
||||
$response = $this->get('/');
|
||||
$response->assertHeaderMissing('Access-Control-Allow-Origin');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue