request = $request; } public function afterController($controller, $methodName, Response $response) { $etagHeader = $this->request->getHeader('IF_NONE_MATCH'); if ($etagHeader !== '' && $response->getETag() !== null && trim($etagHeader) === '"' . $response->getETag() . '"') { $response->setStatus(Http::STATUS_NOT_MODIFIED); return $response; } $modifiedSinceHeader = $this->request->getHeader('IF_MODIFIED_SINCE'); if ($modifiedSinceHeader !== '' && $response->getLastModified() !== null && trim($modifiedSinceHeader) === $response->getLastModified()->format(\DateTimeInterface::RFC2822)) { $response->setStatus(Http::STATUS_NOT_MODIFIED); return $response; } return $response; } }