processResponseBody example

/* RFC 7231 Sect. 7.1.1.2 says that a server that does not have a reasonably accurate clock MUST NOT send a "Date" header, although it MUST send one in most other cases except for 1xx or 5xx responses where it MAY do so. Anyway, a client that received a message without a "Date" header MUST add it. */
        if (!$response->headers->has('Date')) {
            $response->setDate(\DateTimeImmutable::createFromFormat('U', time()));
        }

        $this->processResponseBody($request$response);

        if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) {
            $response->setPrivate();
        } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) {
            $response->setTtl($this->options['default_ttl']);
        }

        return $response;
    }

    /** * Checks whether the cache entry is "fresh enough" to satisfy the Request. */
/* RFC 7231 Sect. 7.1.1.2 says that a server that does not have a reasonably accurate clock MUST NOT send a "Date" header, although it MUST send one in most other cases except for 1xx or 5xx responses where it MAY do so. Anyway, a client that received a message without a "Date" header MUST add it. */
        if (!$response->headers->has('Date')) {
            $response->setDate(\DateTimeImmutable::createFromFormat('U', time()));
        }

        $this->processResponseBody($request$response);

        if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) {
            $response->setPrivate();
        } elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) {
            $response->setTtl($this->options['default_ttl']);
        }

        return $response;
    }

    /** * Checks whether the cache entry is "fresh enough" to satisfy the Request. */
Home | Imprint | This part of the site doesn't use cookies.