From b9cb5a74cc08e63ee7fcb3ca6aafe471f87c1ded Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 19 May 2020 09:39:51 +0200 Subject: [PATCH] Copy over the ETag and LastModified when formatting a Dataresponse This way the ETag checks etc are all working. Signed-off-by: Roeland Jago Douma --- lib/public/AppFramework/Controller.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index ca35d72324..db1f95634e 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -91,6 +91,14 @@ abstract class Controller { unset($headers['Content-Type']); } $response->setHeaders(array_merge($dataHeaders, $headers)); + + if ($data->getETag() !== null) { + $response->setETag($data->getETag()); + } + if ($data->getLastModified() !== null) { + $response->setLastModified($data->getLastModified()); + } + return $response; } return new JSONResponse($data);