[core] Returning 304 http code when returning cached data (#793)

This commit is contained in:
Eugene Molotov 2018-08-26 00:00:38 +05:00 committed by Teromene
parent 059656c370
commit 422c125d8e
3 changed files with 33 additions and 0 deletions

View file

@ -7,6 +7,7 @@ abstract class FormatAbstract implements FormatInterface {
$contentType,
$charset,
$items,
$lastModified,
$extraInfos;
public function setCharset($charset){
@ -27,11 +28,18 @@ abstract class FormatAbstract implements FormatInterface {
return $this;
}
public function setLastModified($lastModified){
$this->lastModified = $lastModified;
}
protected function callContentType(){
header('Content-Type: ' . $this->contentType);
}
public function display(){
if ($this->lastModified) {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $this->lastModified) . 'GMT');
}
echo $this->stringify();
return $this;