Merge pull request #599 from flightphp/cache-correction

Corrected the cache behavior in some areas
pull/601/head v3.11.1
n0nag0n 6 months ago committed by GitHub
commit 7cfaca8f16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -610,6 +610,7 @@ class Engine
try {
$this->response()
->cache(0)
->clearBody()
->status(500)
->write($msg)
@ -736,6 +737,10 @@ class Engine
*/
public function _halt(int $code = 200, string $message = '', bool $actuallyExit = true): void
{
if ($this->response()->getHeader('Cache-Control') === null) {
$this->response()->cache(0);
}
$this->response()
->clearBody()
->status($code)

@ -286,7 +286,7 @@ class Response
*/
public function cache($expires): self
{
if ($expires === false) {
if ($expires === false || $expires === 0) {
$this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
$this->headers['Pragma'] = 'no-cache';

Loading…
Cancel
Save