mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Allow JSON requests with actual JSON payload
This commit is contained in:
parent
945c09059a
commit
dd603639e0
1 changed files with 15 additions and 7 deletions
|
|
@ -1051,11 +1051,11 @@ class Context
|
||||||
*/
|
*/
|
||||||
public static function convertEncodingStr($str)
|
public static function convertEncodingStr($str)
|
||||||
{
|
{
|
||||||
if (!$str || utf8_check($str))
|
if (!$str || utf8_check($str))
|
||||||
{
|
{
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new stdClass;
|
$obj = new stdClass;
|
||||||
$obj->str = $str;
|
$obj->str = $str;
|
||||||
$obj = self::convertEncoding($obj);
|
$obj = self::convertEncoding($obj);
|
||||||
|
|
@ -1254,8 +1254,16 @@ class Context
|
||||||
}
|
}
|
||||||
elseif(self::getRequestMethod() === 'JSON')
|
elseif(self::getRequestMethod() === 'JSON')
|
||||||
{
|
{
|
||||||
$params = array();
|
if(substr($GLOBALS['HTTP_RAW_POST_DATA'], 0, 1) === '{' && substr($GLOBALS['HTTP_RAW_POST_DATA'], -1, 1) === '}')
|
||||||
parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
|
{
|
||||||
|
$params = json_decode($GLOBALS['HTTP_RAW_POST_DATA']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$params = array();
|
||||||
|
parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($params as $key => $val)
|
foreach($params as $key => $val)
|
||||||
{
|
{
|
||||||
if (isset($request_args[$key]))
|
if (isset($request_args[$key]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue