function AssetOptimizationTest::assertBrotli
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php \Drupal\FunctionalTests\Asset\AssetOptimizationTest::assertBrotli()
Tests brotli compression.
Parameters
string $url: The source URL.
File
-
core/
tests/ Drupal/ FunctionalTests/ Asset/ AssetOptimizationTest.php, line 218
Class
- AssetOptimizationTest
- Tests asset aggregation.
Namespace
Drupal\FunctionalTests\AssetCode
protected function assertBrotli(string $url) : void {
$this->getSession()
->setRequestHeader('Accept-Encoding', 'br');
$this->getSession()
->visit($url);
$this->assertSession()
->statusCodeEquals(200);
// Guzzle decodes the brotli response automatically but adds the original
// Content-Encoding value in this header.
$this->assertSession()
->responseHeaderEquals('x-encoded-content-encoding', 'br');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.