Update uri.php

This commit is contained in:
Namhyeon Go 2019-03-28 14:23:26 +09:00 committed by GitHub
parent e031244899
commit 6a20739eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,7 @@ if(!check_function_exists("read_requests")) {
"_SEAL" => false
);
// check if json request
// check if json or serialized request
foreach(getallheaders() as $name=>$value) {
if($name == "Content-Type") {
if($value == "application/json") {
@ -112,9 +112,17 @@ if(!check_function_exists("read_requests")) {
}
}
// check if `JSONData` request (referenced from NHBank API competition)
$jsondata = false;
if(!array_key_empty("JSONData", $requests['_ALL'])) {
$options['json'] = true;
$jsondata = get_value_in_array("JSONData", $requests['_ALL'], false);
}
// check if json request
if(array_key_equals("json", $options, true)) {
$requests['_JSON'] = json_decode($requests['_RAW']);
$jsondata = ($jsondata !== false) ? $jsondata : $requests['_RAW'];
$requests['_JSON'] = json_decode($jsondata);
}
// check if seal(serialize) request
@ -348,9 +356,9 @@ if(!check_function_exists("set_header_content_type")) {
}
}
if(!check_function_exists("get_requested_json_value")) {
function get_requested_json_value($name, $escape_quotes=true, $escape_tags=false) {
return get_requested_value($name, "_JSON", $escape_quotes, $escape_tags);
if(!check_function_exists("get_requested_jsondata")) {
function get_requested_jsondata($name, $escape_quotes=true, $escape_tags=false) {
return get_requested_jsondata($name, "_JSON", $escape_quotes, $escape_tags);
}
}