
| Current Path : /var/www/html/rocksensor2/web/core/tests/Drupal/FunctionalTests/HttpKernel/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor2/web/core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php |
<?php
declare(strict_types=1);
namespace Drupal\FunctionalTests\HttpKernel;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Tests Content-Length set by Drupal.
*
* @group Http
*/
class ContentLengthTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['system', 'http_middleware_test'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
public function testContentLength(): void {
// Fire off a request.
$this->drupalGet(Url::fromRoute('http_middleware_test.test_response'));
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->responseHeaderEquals('Content-Length', '40');
$this->setContainerParameter('no-alter-content-length', TRUE);
$this->rebuildContainer();
// Fire the same exact request but this time length is different.
$this->drupalGet(Url::fromRoute('http_middleware_test.test_response'));
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->responseHeaderEquals('Content-Length', '41');
}
}