prettified and added max-age=0

pull/598/head
Austin Collier 7 months ago
parent f06febdb2d
commit ba80e047b1

@ -288,7 +288,7 @@ class Response
{ {
if ($expires === false) { if ($expires === false) {
$this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; $this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'; $this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
$this->headers['Pragma'] = 'no-cache'; $this->headers['Pragma'] = 'no-cache';
} else { } else {
$expires = \is_int($expires) ? $expires : strtotime($expires); $expires = \is_int($expires) ? $expires : strtotime($expires);
@ -432,7 +432,6 @@ class Response
} }
if ($this->headersSent() === false) { if ($this->headersSent() === false) {
// If you haven't set a Cache-Control header, we'll assume you don't want caching // If you haven't set a Cache-Control header, we'll assume you don't want caching
if ($this->getHeader('Cache-Control') === null) { if ($this->getHeader('Cache-Control') === null) {
$this->cache(false); $this->cache(false);

@ -361,8 +361,7 @@ class FlightTest extends TestCase
string $output, string $output,
array $renderParams, array $renderParams,
string $regexp string $regexp
): void ): void {
{
Flight::view()->preserveVars = false; Flight::view()->preserveVars = false;
$this->expectOutputString($output); $this->expectOutputString($output);

@ -164,7 +164,7 @@ class ResponseTest extends TestCase
$response->cache(false); $response->cache(false);
$this->assertEquals([ $this->assertEquals([
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
'Cache-Control' => 'no-store, no-cache, must-revalidate', 'Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0',
'Pragma' => 'no-cache' 'Pragma' => 'no-cache'
], $response->headers()); ], $response->headers());
} }
@ -269,7 +269,7 @@ class ResponseTest extends TestCase
'Content-Type: text/html', 'Content-Type: text/html',
'X-Test: test', 'X-Test: test',
'Expires: Mon, 26 Jul 1997 05:00:00 GMT', 'Expires: Mon, 26 Jul 1997 05:00:00 GMT',
'Cache-Control: no-store, no-cache, must-revalidate', 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0',
'Pragma: no-cache', 'Pragma: no-cache',
'Content-Length: 9' 'Content-Length: 9'
], $sent_headers); ], $sent_headers);

Loading…
Cancel
Save