public function BlockInterestCohortTest::testExistingPolicyHeader in Drupal 9
Tests that an existing header is not modified.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Http/ BlockInterestCohortTest.php, line 47
Class
- BlockInterestCohortTest
- Tests the Permissions-Policy header added by FinishResponseSubscriber.
Namespace
Drupal\KernelTests\Core\HttpCode
public function testExistingPolicyHeader() {
$headers['Permissions-Policy'] = 'geolocation=()';
$kernel = \Drupal::service('http_kernel');
$request = Request::create('/');
$response = new Response('', 200, $headers);
$event = new ResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response);
\Drupal::service('finish_response_subscriber')
->onRespond($event);
$this
->assertSame($headers['Permissions-Policy'], $response->headers
->get('Permissions-Policy'));
}