Skip to content

Commit 3e131f5

Browse files
committed
[HttpKernel] fixed invalid test
According to ResponseHeaderBag::computeCacheControlValue(), a response with an ETag but no explicit Cache-Control header should have a sensible Cache-Control of "private, must-revalidate" set. According to Response::isCacheable(), a response that includes a private Cache-Controls is not considered cacheable. Therefore, in order for this test response to be cacheable and stored, it requires an explicit Cache-Control of public.
1 parent a0bae94 commit 3e131f5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/Symfony/Tests/Component/HttpKernel/HttpCache/HttpCacheTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public function testValidatesPrivateResponsesCachedOnTheClient()
168168
$response->setContent('private data');
169169
}
170170
} else {
171+
$response->headers->set('Cache-Control', 'public');
171172
$response->setETag('"public tag"');
172173
if (in_array('"public tag"', $etags)) {
173174
$response->setStatusCode(304);

0 commit comments

Comments
 (0)