From d02e7d4004a3730950cf46f741d4e05d5b86fa6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20W=C3=B6ster?= Date: Tue, 10 Sep 2013 14:27:22 +0200 Subject: [PATCH] add checks for GET and OPTIONS requests --- framework/yii/web/Request.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/framework/yii/web/Request.php b/framework/yii/web/Request.php index c6e1ce3..2b9da0a 100644 --- a/framework/yii/web/Request.php +++ b/framework/yii/web/Request.php @@ -137,6 +137,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. */