Skip to content

Commit

Permalink
Update uri.php
Browse files Browse the repository at this point in the history
  • Loading branch information
gnh1201 authored May 21, 2020
1 parent f9db90f commit fb1e4bf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions system/uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @file uri.php
* @created_on 2018-04-13
* @updated_on 2020-04-12
* @updated_on 2020-05-21
* @author Go Namhyeon <[email protected]>
* @brief URI module
*/
Expand Down Expand Up @@ -103,6 +103,7 @@ function read_requests($options=array()) {
"_RAW" => file_get_contents("php://input"),
"_JSON" => false,
"_SEAL" => false,
"_YAML" => false,
"_CSPT" => false,
"_SERVER" => array_map("make_safe_argument", get_array($_SERVER)),
);
Expand All @@ -120,7 +121,7 @@ function read_requests($options=array()) {
}
}

// check if `JSONData` request (referenced from NHBank API competition)
// check if `JSONData` request (referenced from `2018 NHBank-KISA-TheLoop API competition`)
$jsondata = false;
if(!array_key_empty("JSONData", $requests['_ALL'])) {
$options['json'] = true;
Expand All @@ -129,7 +130,7 @@ function read_requests($options=array()) {

// check if json request
if(array_key_equals("json", $options, true)) {
$jsondata = ($jsondata !== false) ? $jsondata : $requests['_RAW'];
$jsondata = ($jsondata !== false) ? $js ondata : $requests['_RAW'];
$requests['_JSON'] = json_decode($jsondata);
}

Expand All @@ -138,6 +139,13 @@ function read_requests($options=array()) {
$requests['_SEAL'] = unserialize($requests['_RAW']);
}

// check if yaml request
if(array_key_equals("yaml", $options, true)) {
if(is_fn("yaml_parse")) {
$requests['_YAML'] = yaml_parse($requests['_RAW']);
}
}

// check if cspt(catsplit) request
if(array_key_equals("catsplit", $options, true)) {
if(loadHelper("catsplit.format")) {
Expand Down

0 comments on commit fb1e4bf

Please sign in to comment.