mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-09-02 18:25:11 +00:00
more caching, default content type
This commit is contained in:
parent
abfa81aef1
commit
7b8ec49dd6
1 changed files with 6 additions and 0 deletions
|
@ -169,6 +169,7 @@ class Response
|
||||||
public static function enableHttpCache(int $seconds = 300)
|
public static function enableHttpCache(int $seconds = 300)
|
||||||
{
|
{
|
||||||
static::addCacheControlHeader('max-age', $seconds);
|
static::addCacheControlHeader('max-age', $seconds);
|
||||||
|
static::setHeader('Pragma', 'public');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addCacheControlHeader(string $name, $value = null)
|
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');
|
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();
|
$headers = static::getHeaders();
|
||||||
|
|
||||||
if (isset($headers[static::HEADER_STATUS]))
|
if (isset($headers[static::HEADER_STATUS]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue