You are here

public function BigPipeSessionlessRegressionTest::testHeadRequestForIssue2942484 in Sessionless BigPipe 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/BigPipeSessionlessRegressionTest.php \Drupal\Tests\big_pipe_sessionless\Functional\BigPipeSessionlessRegressionTest::testHeadRequestForIssue2942484()

HEAD requests must not result in 500 responses.

See also

https://www.drupal.org/project/big_pipe_sessionless/issues/2942484

File

tests/src/Functional/BigPipeSessionlessRegressionTest.php, line 37

Class

BigPipeSessionlessRegressionTest
Sessionless BigPipe regression tests.

Namespace

Drupal\Tests\big_pipe_sessionless\Functional

Code

public function testHeadRequestForIssue2942484() {

  /** @var \GuzzleHttp\ClientInterface $client */
  $client = $this
    ->getSession()
    ->getDriver()
    ->getClient()
    ->getClient();
  Cache::invalidateTags([
    'rendered',
  ]);
  $response = $client
    ->request('HEAD', $this
    ->getAbsoluteUrl('/'));
  $this
    ->assertSame(200, $response
    ->getStatusCode());
  $this
    ->assertFalse($response
    ->hasHeader('Surrogate-Control'));
  $this
    ->assertFalse($response
    ->hasHeader('X-Accel-Buffering'));
  $this
    ->assertSame([
    'MISS',
  ], $response
    ->getHeader('X-Drupal-Cache'));
  $this
    ->assertSame([
    'MISS',
  ], $response
    ->getHeader('X-Drupal-Dynamic-Cache'));
}