class AlterContentMiddleware
Same name in other branches
- 10 core/modules/system/tests/modules/http_middleware_test/src/StackMiddleware/AlterContentMiddleware.php \Drupal\http_middleware_test\StackMiddleware\AlterContentMiddleware
Alters the response before content length is calculated.
Hierarchy
- class \Drupal\http_middleware_test\StackMiddleware\AlterContentMiddleware implements \Symfony\Component\HttpKernel\HttpKernelInterface
Expanded class hierarchy of AlterContentMiddleware
1 string reference to 'AlterContentMiddleware'
- http_middleware_test.services.yml in core/
modules/ system/ tests/ modules/ http_middleware_test/ http_middleware_test.services.yml - core/modules/system/tests/modules/http_middleware_test/http_middleware_test.services.yml
1 service uses AlterContentMiddleware
- http_middleware.alter_content_middleware in core/
modules/ system/ tests/ modules/ http_middleware_test/ http_middleware_test.services.yml - Drupal\http_middleware_test\StackMiddleware\AlterContentMiddleware
File
-
core/
modules/ system/ tests/ modules/ http_middleware_test/ src/ StackMiddleware/ AlterContentMiddleware.php, line 14
Namespace
Drupal\http_middleware_test\StackMiddlewareView source
final class AlterContentMiddleware implements HttpKernelInterface {
public function __construct(HttpKernelInterface $httpKernel) {
}
/**
* {@inheritdoc}
*/
public function handle(Request $request, int $type = self::MAIN_REQUEST, bool $catch = TRUE) : Response {
$response = $this->httpKernel
->handle($request, $type, $catch);
if (\Drupal::getContainer()->hasParameter('no-alter-content-length') && \Drupal::getContainer()->getParameter('no-alter-content-length')) {
$response->setContent('<html><body><p>Avocados</p></body></html>');
}
return $response;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
AlterContentMiddleware::handle | public | function | |
AlterContentMiddleware::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.