mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Set Last Modified to notes response..
This commit is contained in:
@@ -54,8 +54,13 @@ class NoteController extends Controller {
|
|||||||
$notes = $this->noteService->getAll($this->userId);
|
$notes = $this->noteService->getAll($this->userId);
|
||||||
$etag = md5(json_encode($notes));
|
$etag = md5(json_encode($notes));
|
||||||
|
|
||||||
|
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||||
|
$timestamp = max(array_map(function($note) { return $note->getTimestamp(); }, $notes));
|
||||||
|
$lastModified->setTimestamp($timestamp);
|
||||||
|
|
||||||
$response = new JSONResponse($notes);
|
$response = new JSONResponse($notes);
|
||||||
$response->setETag($etag);
|
$response->setETag($etag);
|
||||||
|
$response->setLastModified($lastModified);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user