mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-01 05:02:39 +00:00
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:
@@ -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',
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user