Allow JSON requests with actual JSON payload

This commit is contained in:
Kijin Sung 2020-07-02 16:13:31 +09:00
parent 945c09059a
commit dd603639e0

View file

@ -1253,9 +1253,17 @@ class Context
}
}
elseif(self::getRequestMethod() === 'JSON')
{
if(substr($GLOBALS['HTTP_RAW_POST_DATA'], 0, 1) === '{' && substr($GLOBALS['HTTP_RAW_POST_DATA'], -1, 1) === '}')
{
$params = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
}
else
{
$params = array();
parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
}
foreach($params as $key => $val)
{
if (isset($request_args[$key]))