Browse Source

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.
mark_story 13 years ago
parent
commit
54679023f9

+ 1 - 1
lib/Cake/Network/CakeRequest.php

@@ -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);

+ 1 - 0
lib/Cake/Test/Case/Network/CakeRequestTest.php

@@ -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))