Loading src/EventSubscriber/CacheableResponseSubscriber.php +2 −13 Original line number Diff line number Diff line Loading @@ -51,19 +51,8 @@ class CacheableResponseSubscriber implements EventSubscriberInterface { // Only set any headers when this is a cacheable response. $response = $event->getResponse(); // Cache tags should be injected only when the response is cacheable. It is // cacheable when dynamic_page_cache module (if enabled) says so. // Alternatively, if dynamic_page_cache module is uninstalled, then we // fallback on testing that at least 'no-cache' cache directive is not // present in the response headers. $cacheTagsNeeded = $response instanceof CacheableResponseInterface; if ($response->headers->has('X-Drupal-Dynamic-Cache')) { $cacheTagsNeeded = $cacheTagsNeeded && $response->headers->get('X-Drupal-Dynamic-Cache') !== 'UNCACHEABLE'; } $cacheTagsNeeded = $cacheTagsNeeded && !$response->headers->hasCacheControlDirective('no-cache'); if ($cacheTagsNeeded) { if ($response instanceof CacheableResponseInterface && !$response->headers->hasCacheControlDirective('no-cache')) { // Iterate all tagsheader plugins and add a header for each plugin. $tags = $response->getCacheableMetadata()->getCacheTags(); Loading Loading
src/EventSubscriber/CacheableResponseSubscriber.php +2 −13 Original line number Diff line number Diff line Loading @@ -51,19 +51,8 @@ class CacheableResponseSubscriber implements EventSubscriberInterface { // Only set any headers when this is a cacheable response. $response = $event->getResponse(); // Cache tags should be injected only when the response is cacheable. It is // cacheable when dynamic_page_cache module (if enabled) says so. // Alternatively, if dynamic_page_cache module is uninstalled, then we // fallback on testing that at least 'no-cache' cache directive is not // present in the response headers. $cacheTagsNeeded = $response instanceof CacheableResponseInterface; if ($response->headers->has('X-Drupal-Dynamic-Cache')) { $cacheTagsNeeded = $cacheTagsNeeded && $response->headers->get('X-Drupal-Dynamic-Cache') !== 'UNCACHEABLE'; } $cacheTagsNeeded = $cacheTagsNeeded && !$response->headers->hasCacheControlDirective('no-cache'); if ($cacheTagsNeeded) { if ($response instanceof CacheableResponseInterface && !$response->headers->hasCacheControlDirective('no-cache')) { // Iterate all tagsheader plugins and add a header for each plugin. $tags = $response->getCacheableMetadata()->getCacheTags(); Loading