Use Content-Type header stored in CONTENT_TYPE per RFC 3875

Normalize $_SERVER['CONTENT_TYPE'] with value from $_SERVER['HTTP_CONTENT_TYPE']
This commit is contained in:
Zach Borboa
2014-04-17 22:14:49 -07:00
parent e1ef501ea1
commit 7bbed34b16
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -350,7 +350,7 @@ class CurlTest extends PHPUnit_Framework_TestCase {
$test->curl->setHeader('X-Requested-With', 'XMLHttpRequest');
$test->curl->setHeader('Accept', 'application/json');
$this->assertTrue($test->server('server', 'GET', array(
'key' => 'HTTP_CONTENT_TYPE', // OR "CONTENT_TYPE".
'key' => 'CONTENT_TYPE',
)) === 'application/json');
$this->assertTrue($test->server('server', 'GET', array(
'key' => 'HTTP_X_REQUESTED_WITH',
+3
View File
@@ -4,6 +4,9 @@ $_PUT = array();
$_PATCH = array();
$request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
if (!array_key_exists('CONTENT_TYPE', $_SERVER) && array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
$_SERVER['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
}
$content_type = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
$data_values = $_GET;
if ($request_method === 'POST') {