Expose etag through JSON responses for child elements
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
namespace OCA\Deck\Controller;
|
||||
|
||||
use OCA\Deck\Db\Board;
|
||||
use OCA\Deck\StatusException;
|
||||
use OCP\AppFramework\ApiController;
|
||||
use OCP\AppFramework\Http;
|
||||
@@ -72,7 +73,11 @@ class BoardApiController extends ApiController {
|
||||
}
|
||||
$boards = $this->boardService->findAll($date->getTimestamp(), $details);
|
||||
}
|
||||
return new DataResponse($boards, HTTP::STATUS_OK);
|
||||
$response = new DataResponse($boards, HTTP::STATUS_OK);
|
||||
$response->setETag(md5(json_encode(array_map(function (Board $board) {
|
||||
return $board->getId() . '-' . $board->getETag();
|
||||
}, $boards))));
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user