Skip to content

Commit 71da547

Browse files
ACPT-1277: GraphQlCache plugin need to use response parameter
1 parent a74f840 commit 71da547

File tree

1 file changed

+5
-11
lines changed
  • app/code/Magento/GraphQlCache/Controller/Plugin

1 file changed

+5
-11
lines changed

app/code/Magento/GraphQlCache/Controller/Plugin/GraphQl.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ class GraphQl
3232
*/
3333
private $config;
3434

35-
/**
36-
* @var ResponseHttp
37-
*/
38-
private $response;
39-
4035
/**
4136
* @var HttpRequestProcessor
4237
*/
@@ -55,7 +50,7 @@ class GraphQl
5550
/**
5651
* @param CacheableQuery $cacheableQuery
5752
* @param Config $config
58-
* @param ResponseHttp $response
53+
* @param ResponseHttp $response @deprecated do not use
5954
* @param HttpRequestProcessor $requestProcessor
6055
* @param Registry $registry
6156
* @param CacheIdCalculator $cacheIdCalculator
@@ -70,7 +65,6 @@ public function __construct(
7065
) {
7166
$this->cacheableQuery = $cacheableQuery;
7267
$this->config = $config;
73-
$this->response = $response;
7468
$this->requestProcessor = $requestProcessor;
7569
$this->registry = $registry;
7670
$this->cacheIdCalculator = $cacheIdCalculator;
@@ -112,12 +106,12 @@ public function afterRenderResult(ResultInterface $subject, ResultInterface $res
112106

113107
$cacheId = $this->cacheIdCalculator->getCacheId();
114108
if ($cacheId) {
115-
$this->response->setHeader(CacheIdCalculator::CACHE_ID_HEADER, $cacheId, true);
109+
$response->setHeader(CacheIdCalculator::CACHE_ID_HEADER, $cacheId, true);
116110
}
117111

118112
if ($this->cacheableQuery->shouldPopulateCacheHeadersWithTags()) {
119-
$this->response->setPublicHeaders($this->config->getTtl());
120-
$this->response->setHeader('X-Magento-Tags', implode(',', $this->cacheableQuery->getCacheTags()), true);
113+
$response->setPublicHeaders($this->config->getTtl());
114+
$response->setHeader('X-Magento-Tags', implode(',', $this->cacheableQuery->getCacheTags()), true);
121115
} else {
122116
$sendNoCacheHeaders = true;
123117
}
@@ -126,7 +120,7 @@ public function afterRenderResult(ResultInterface $subject, ResultInterface $res
126120
}
127121

128122
if ($sendNoCacheHeaders) {
129-
$this->response->setNoCacheHeaders();
123+
$response->setNoCacheHeaders();
130124
}
131125

132126
return $result;

0 commit comments

Comments
 (0)