summaryrefslogtreecommitdiffstats
path: root/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
diff options
context:
space:
mode:
authorNathaniel Catchpole2015-04-27 13:17:49 +0100
committerNathaniel Catchpole2015-04-27 13:17:49 +0100
commitea6548bcb1ea495b7abb3c62a131ffd318f65a5c (patch)
tree29802919c4882f5cc044ada2e74bbc0a66991bfd /core/modules/rest/src/Plugin/rest/resource/EntityResource.php
parent669fe99146bf6a763b910391f051f5e8e638664f (diff)
Issue #2463009 by Wim Leers: Introduce CacheableResponseInterface: consolidate ways of setting X-Drupal-Cache-Tags/Contexts headers
Diffstat (limited to 'core/modules/rest/src/Plugin/rest/resource/EntityResource.php')
-rw-r--r--core/modules/rest/src/Plugin/rest/resource/EntityResource.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
index 2c5eea9..448a353 100644
--- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
@@ -55,7 +55,11 @@ class EntityResource extends ResourceBase {
}
}
- return new ResourceResponse($entity, 200, ['X-Drupal-Cache-Tags' => implode(' ', $entity->getCacheTags())]);
+ $response = new ResourceResponse($entity, 200);
+ // Make the response use the entity's cacheability metadata.
+ // @todo include access cacheability metadata, for the access checks above.
+ $response->addCacheableDependency($entity);
+ return $response;
}
/**