public function FinishResponseSubscriber::onAllResponds in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php \Drupal\Core\EventSubscriber\FinishResponseSubscriber::onAllResponds()
Sets extra headers on any responses, also subrequest ones.
Parameters
\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.
File
- core/
lib/ Drupal/ Core/ EventSubscriber/ FinishResponseSubscriber.php, line 97
Class
- FinishResponseSubscriber
- Response subscriber to handle finished responses.
Namespace
Drupal\Core\EventSubscriberCode
public function onAllResponds(ResponseEvent $event) {
$response = $event
->getResponse();
// Always add the 'http_response' cache tag to be able to invalidate every
// response, for example after rebuilding routes.
if ($response instanceof CacheableResponseInterface) {
$response
->getCacheableMetadata()
->addCacheTags([
'http_response',
]);
}
}