mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add support for DELETE + form encoded data.
Much like PUT, DELETE requests will automatically parse form-urlencoded request bodies and set them as $this->data.
This commit is contained in:
parent
c5b19b658a
commit
54679023f9
2 changed files with 2 additions and 1 deletions
|
@ -163,7 +163,7 @@ class CakeRequest implements ArrayAccess {
|
|||
protected function _processPost() {
|
||||
if ($_POST) {
|
||||
$this->data = $_POST;
|
||||
} elseif ($this->is('put')) {
|
||||
} elseif ($this->is('put') || $this->is('delete')) {
|
||||
$this->data = $this->_readInput();
|
||||
if (env('CONTENT_TYPE') === 'application/x-www-form-urlencoded') {
|
||||
parse_str($this->data, $this->data);
|
||||
|
|
|
@ -268,6 +268,7 @@ class CakeRequestTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEquals($expected, $request->data);
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||
$data = array('data' => array(
|
||||
'Article' => array('title'),
|
||||
'Tag' => array('Tag' => array(1, 2))
|
||||
|
|
Loading…
Reference in a new issue