function 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 68
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',
]);
}
}