Skip to content

Commit

Permalink
Merge pull request yiisoft#866 from bwoester/more-request-method-checks
Browse files Browse the repository at this point in the history
More request method checks
  • Loading branch information
samdark committed Sep 13, 2013
2 parents 91b6e29 + 64d57b3 commit 4e2db36
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions framework/yii/web/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,33 @@ public function getMethod()
}
}

/**
* 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 HEAD request.
* @return boolean whether this is a HEAD request.
*/
public function getIsHead()
{
return $this->getMethod() === 'HEAD';
}

/**
* Returns whether this is a POST request.
* @return boolean whether this is a POST request.
Expand Down

0 comments on commit 4e2db36

Please sign in to comment.