Browse Source

Make CakeRequest work with content-type headers that include a charset.

Refs #3113
mark_story 13 years ago
parent
commit
e183e91b17

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

@@ -165,7 +165,7 @@ class CakeRequest implements ArrayAccess {
 			$this->data = $_POST;
 		} elseif ($this->is('put') || $this->is('delete')) {
 			$this->data = $this->_readInput();
-			if (env('CONTENT_TYPE') === 'application/x-www-form-urlencoded') {
+			if (strpos(env('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0) {
 				parse_str($this->data, $this->data);
 			}
 		}

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

@@ -233,7 +233,7 @@ class CakeRequestTest extends CakeTestCase {
  */
 	public function testPutParsing() {
 		$_SERVER['REQUEST_METHOD'] = 'PUT';
-		$_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
+		$_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=UTF-8';
 
 		$data = array('data' => array(
 			'Article' => array('title')