more caching, default content type

This commit is contained in:
Alex Grintsvayg 2016-09-01 19:37:42 -04:00
parent abfa81aef1
commit 7b8ec49dd6

View file

@ -169,6 +169,7 @@ class Response
public static function enableHttpCache(int $seconds = 300)
{
static::addCacheControlHeader('max-age', $seconds);
static::setHeader('Pragma', 'public');
}
public static function addCacheControlHeader(string $name, $value = null)
@ -248,6 +249,11 @@ class Response
throw new LogicException('Headers have already been sent. They cannot be sent twice');
}
if (!static::getHeader(static::HEADER_CONTENT_TYPE))
{
static::setHeader(static::HEADER_CONTENT_TYPE, 'text/html');
}
$headers = static::getHeaders();
if (isset($headers[static::HEADER_STATUS]))