Rabbi_Gerzi/backend/tests/Feature/CorsTest.php

24 lines
649 B
PHP

<?php
namespace Tests\Feature;
use Tests\TestCase;
class CorsTest extends TestCase
{
public function testAllowsProductionFrontendPreflight(): void
{
$response = $this->withHeaders([
'Origin' => 'https://rabbigerzi.com',
'Access-Control-Request-Method' => 'POST',
'Access-Control-Request-Headers' => 'content-type',
])->options('/login');
$response->assertNoContent();
$response->assertHeader(
'Access-Control-Allow-Origin',
'https://rabbigerzi.com'
);
$response->assertHeader('Access-Control-Allow-Credentials', 'true');
}
}