NoServerError.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php
  2. 8.9.x core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php
  3. 11.x core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php

Namespace

Drupal\Core\PageCache\ResponsePolicy

File

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

View source
<?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;
        }
    }

}

Classes

Title Deprecated Summary
NoServerError A policy denying caching of a server error (HTTP 5xx) responses.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.