mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
add checks for GET and OPTIONS requests
This commit is contained in:
@ -136,6 +136,24 @@ class Request extends \yii\base\Request
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is a GET request.
|
||||
* @return boolean whether this is a GET request.
|
||||
*/
|
||||
public function getIsGet()
|
||||
{
|
||||
return $this->getMethod() === 'GET';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is an OPTIONS request.
|
||||
* @return boolean whether this is a OPTIONS request.
|
||||
*/
|
||||
public function getIsOptions()
|
||||
{
|
||||
return $this->getMethod() === 'OPTIONS';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this is a POST request.
|
||||
* @return boolean whether this is a POST request.
|
||||
|
Reference in New Issue
Block a user