summaryrefslogtreecommitdiffstats
path: root/core/modules/rest/src/Plugin/rest
diff options
context:
space:
mode:
authorNathaniel Catchpole2015-07-16 15:26:21 +0100
committerNathaniel Catchpole2015-07-16 15:26:21 +0100
commit20f1c993b6d76be0203138f2091952bc90a4bd61 (patch)
treebad642080f61b5831787c5cd29caee3d639e452c /core/modules/rest/src/Plugin/rest
parentae32aaae81a92118f6de995831919e87e77daa03 (diff)
Issue #2351015 by plach, effulgentsia, Wim Leers, dawehner, martin107, damiankloip, cilefen, Fabianx, catch, pwolanin, Damien Tournoud, znerol, YesCT, larowlan: URL generation does not bubble cache contexts
Diffstat (limited to 'core/modules/rest/src/Plugin/rest')
-rw-r--r--core/modules/rest/src/Plugin/rest/resource/EntityResource.php5
1 files changed, 4 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 8631086..8aa4dc3 100644
--- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
@@ -109,7 +109,10 @@ class EntityResource extends ResourceBase {
$this->logger->notice('Created entity %type with ID %id.', array('%type' => $entity->getEntityTypeId(), '%id' => $entity->id()));
// 201 Created responses have an empty body.
- return new ResourceResponse(NULL, 201, array('Location' => $entity->url('canonical', ['absolute' => TRUE])));
+ $url = $entity->urlInfo('canonical', ['absolute' => TRUE])->toString(TRUE);
+ $response = new ResourceResponse(NULL, 201, ['Location' => $url->getGeneratedUrl()]);
+ $response->addCacheableDependency($url);
+ return $response;
}
catch (EntityStorageException $e) {
throw new HttpException(500, 'Internal Server Error', $e);