Merge pull request #21041 from nextcloud/enh/dataresponse_etag_lastmod

Copy over the ETag and LastModified when formatting a Dataresponse
This commit is contained in:
Morris Jobke 2020-05-19 14:48:27 +02:00 committed by GitHub
commit d26169838e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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);