You are here

class UnsafeMethod in Tome 8

Reject when the HTTP method is not safe.

The policy denies caching if request method is neither GET nor HEAD (see RFC 2616, section 9.1.1 - Safe Methods).

@internal

Hierarchy

Expanded class hierarchy of UnsafeMethod

File

modules/tome_static/src/PageCache/RequestPolicy/UnsafeMethod.php, line 16

Namespace

Drupal\tome_static\PageCache\RequestPolicy
View source
class UnsafeMethod implements RequestPolicyInterface {

  /**
   * {@inheritdoc}
   */
  public function check(Request $request) {
    if (!$request
      ->isMethodCacheable()) {
      return static::DENY;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.
UnsafeMethod::check public function Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface::check