Skip to content

Commit c6a1ee2

Browse files
committed
fix: add cache metadata to response
1 parent 4f1cbae commit c6a1ee2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Controller/MenuController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function menu(Request $request, string $menu): CacheableJsonResponse {
109109
'url.site',
110110
]);
111111
$this->addLanguageFallbackCacheContext($cacheable, $langcode);
112-
$cacheable->applyTo($response);
112+
$response->addCacheableDependency($cacheable);
113113
$this->applySecurityHeaders($response, $cacheable->getCacheMaxAge());
114114

115115
return $response;
@@ -159,7 +159,7 @@ public function menu(Request $request, string $menu): CacheableJsonResponse {
159159
'Content-Type' => self::CONTENT_TYPE,
160160
]);
161161

162-
$cacheability->applyTo($response);
162+
$response->addCacheableDependency($cacheability);
163163
$this->applySecurityHeaders($response, $max_age);
164164

165165
return $response;
@@ -367,7 +367,7 @@ private function errorResponse(int $status, string $title, string $detail): Cach
367367

368368
$cacheable = new CacheableMetadata();
369369
$cacheable->setCacheMaxAge(0);
370-
$cacheable->applyTo($response);
370+
$response->addCacheableDependency($cacheable);
371371
$this->applySecurityHeaders($response, 0);
372372

373373
return $response;

0 commit comments

Comments
 (0)