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