Class page_cache_no_server_error - Source Code

Primary tabs

API docs: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!PageCache!ResponsePolicy!NoServerError.php/11.3.x

GitLab: https://git.drupalcode.org/project/drupal/-/blob/11.3.x/core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php

Location: /core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php

    
        
namespace Drupal\Core\PageCache\ResponsePolicy;

use Drupal\Core\PageCache\ResponsePolicyInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * A policy denying caching of a server error (HTTP 5xx) responses.
 */
class NoServerError implements ResponsePolicyInterface {

  /**
   * {@inheritdoc}
   */
  public function check(Response $response, Request $request) {
    if ($response->isServerError()) {
      return static::DENY;
    }
  }

}