diff --git a/src/Hasher/DefaultHasher.php b/src/Hasher/DefaultHasher.php index d182747..dee09cb 100644 --- a/src/Hasher/DefaultHasher.php +++ b/src/Hasher/DefaultHasher.php @@ -18,10 +18,19 @@ public function getHashFor(Request $request): string $cacheNameSuffix = $this->getCacheNameSuffix($request); return 'responsecache-' . md5( - "{$request->getHost()}-{$request->getRequestUri()}-{$request->getMethod()}/$cacheNameSuffix" + "{$request->getHost()}-{$this->getNormalizedRequestUri($request)}-{$request->getMethod()}/$cacheNameSuffix" ); } + protected function getNormalizedRequestUri(Request $request): string + { + if ($queryString = $request->getQueryString()) { + $queryString = '?'.$queryString; + } + + return $request->getBaseUrl().$request->getPathInfo().$queryString; + } + protected function getCacheNameSuffix(Request $request) { if ($request->attributes->has('responsecache.cacheNameSuffix')) {