Skip to content

Commit 236fdec

Browse files
mpdudenicolas-grekas
authored andcommitted
[HttpFoundation] Use Cache-Control: must-revalidate only if explicit lifetime has been given
1 parent 48a076d commit 236fdec

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

HttpCache/ResponseCacheStrategy.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ public function update(Response $response)
110110
$response->headers->set('Age', $this->age);
111111

112112
if ($this->isNotCacheableResponseEmbedded) {
113-
$response->setExpires($response->getDate());
114-
115113
if ($this->flagDirectives['no-store']) {
116114
$response->headers->set('Cache-Control', 'no-cache, no-store, must-revalidate');
117115
} else {

Tests/HttpCache/HttpCacheTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,6 @@ public function testEsiCacheForceValidation()
12421242
$this->request('GET', '/', [], [], true);
12431243
$this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent());
12441244
$this->assertNull($this->response->getTtl());
1245-
$this->assertTrue($this->response->mustRevalidate());
12461245
$this->assertTrue($this->response->headers->hasCacheControlDirective('private'));
12471246
$this->assertTrue($this->response->headers->hasCacheControlDirective('no-cache'));
12481247
}
@@ -1273,7 +1272,6 @@ public function testEsiCacheForceValidationForHeadRequests()
12731272
// This can neither be cached nor revalidated, so it should be private/no cache
12741273
$this->assertEmpty($this->response->getContent());
12751274
$this->assertNull($this->response->getTtl());
1276-
$this->assertTrue($this->response->mustRevalidate());
12771275
$this->assertTrue($this->response->headers->hasCacheControlDirective('private'));
12781276
$this->assertTrue($this->response->headers->hasCacheControlDirective('no-cache'));
12791277
}

0 commit comments

Comments
 (0)