FIX Allow setNoCache(false) to remove no-cache directive

This commit is contained in:
Daniel Hensby 2018-07-05 22:51:39 +01:00
parent 18b7dc235a
commit 92f5ef31d8
No known key found for this signature in database
GPG Key ID: D8DEBC4C8E7BC8B9

View File

@ -499,7 +499,13 @@ class HTTPCacheControlMiddleware implements HTTPMiddleware, Resettable
{
// Affect all non-disabled states
$applyTo = [self::STATE_ENABLED, self::STATE_PRIVATE, self::STATE_PUBLIC];
$this->setStateDirective($applyTo, 'no-cache', $noCache);
if ($noCache) {
$this->setStateDirective($applyTo, 'no-cache');
$this->removeStateDirective($applyTo, 'max-age');
$this->removeStateDirective($applyTo, 's-maxage');
} else {
$this->removeStateDirective($applyTo, 'no-cache');
}
return $this;
}