Skip to content

Commit

Permalink
Merge a50c6d7 into 3a12c8a
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Mar 26, 2021
2 parents 3a12c8a + a50c6d7 commit 9700922
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@
* GraphQL: Partial pagination support (#3223)
* GraphQL: Manage `pagination_use_output_walkers` and `pagination_fetch_join_collection` for operations (#3311)
* Swagger UI: Remove Google fonts (#4112)
* Doctrine: Revert #3774 support for binary UUID in search filter (#4134)
* Do not override Vary headers already set in the Response

## 2.6.3

Expand Down
7 changes: 3 additions & 4 deletions src/HttpCache/EventListener/AddHeadersListener.php
Expand Up @@ -74,10 +74,9 @@ public function onKernelResponse(ResponseEvent $event): void
$response->setMaxAge($maxAge);
}

if (isset($resourceCacheHeaders['vary'])) {
$response->setVary($resourceCacheHeaders['vary']);
} elseif (null !== $this->vary) {
$response->setVary(array_diff($this->vary, $response->getVary()), false);
$vary = $resourceCacheHeaders['vary'] ?? $this->vary;
if (null !== $vary) {
$response->setVary(array_diff($vary, $response->getVary()), false);
}

// if the public-property is defined and not yet set; apply it to the response
Expand Down
2 changes: 1 addition & 1 deletion tests/HttpCache/EventListener/AddHeadersListenerTest.php
Expand Up @@ -162,7 +162,7 @@ public function testSetHeadersFromResourceMetadata()
$listener->onKernelResponse($event);

$this->assertSame('max-age=123, public, s-maxage=456, stale-if-error=70, stale-while-revalidate=928', $response->headers->get('Cache-Control'));
$this->assertSame(['Vary-1', 'Vary-2'], $response->getVary());
$this->assertSame(['Accept', 'Cookie', 'Vary-1', 'Vary-2'], $response->getVary());
}

public function testSetHeadersFromResourceMetadataMarkedAsPrivate()
Expand Down

0 comments on commit 9700922

Please sign in to comment.