NoServerError.php 508 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace Drupal\Core\PageCache\ResponsePolicy;
  3. use Drupal\Core\PageCache\ResponsePolicyInterface;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. /**
  7. * A policy denying caching of a server error (HTTP 5xx) responses.
  8. */
  9. class NoServerError implements ResponsePolicyInterface {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function check(Response $response, Request $request) {
  14. if ($response->isServerError()) {
  15. return static::DENY;
  16. }
  17. }
  18. }