Symfony\Component\HttpFoundation\Request::isMethodCacheable PHP Method

isMethodCacheable() public method

Checks whether the method is cacheable or not.
See also: https://tools.ietf.org/html/rfc7231#section-4.2.3
public isMethodCacheable ( ) : boolean
return boolean
    public function isMethodCacheable()
    {
        return in_array($this->getMethod(), array('GET', 'HEAD'));
    }

Usage Example

Example #1
0
 /**
  * @dataProvider methodCacheableProvider
  */
 public function testMethodCacheable($method, $chacheable)
 {
     $request = new Request();
     $request->setMethod($method);
     $this->assertEquals($chacheable, $request->isMethodCacheable());
 }