Automatically handle PUT requests

make the following "just work"

    curl -X PUT -d foo=bar http://...
This commit is contained in:
AD7six 2012-06-06 22:58:27 +02:00
parent d1475b1fd3
commit b509bdb04b
2 changed files with 110 additions and 2 deletions

View file

@ -161,7 +161,14 @@ class CakeRequest implements ArrayAccess {
* @return void
*/
protected function _processPost() {
$this->data = $_POST;
if ($_POST) {
$this->data = $_POST;
} elseif ($this->is('put')) {
$this->data = $this->_readInput();
if (env('CONTENT_TYPE') === 'application/x-www-form-urlencoded') {
parse_str($this->data, $this->data);
}
}
if (ini_get('magic_quotes_gpc') === '1') {
$this->data = stripslashes_deep($this->data);
}