add support RAW request

This commit is contained in:
Namhyeon Go 2018-12-31 10:59:58 +09:00
parent 6a829e0769
commit 81238fa076

View File

@ -50,6 +50,7 @@ if(!function_exists("read_requests")) {
"_GET" => $_GET, "_GET" => $_GET,
"_URI" => get_value_in_array("REQUEST_URI", $_SERVER, false), "_URI" => get_value_in_array("REQUEST_URI", $_SERVER, false),
"_FILES" => get_array($_FILES), "_FILES" => get_array($_FILES),
"_RAW" => file_get_contents('php://input'),
"_JSON" => false, "_JSON" => false,
"_SEAL" => false "_SEAL" => false
); );
@ -59,7 +60,7 @@ if(!function_exists("read_requests")) {
if($name == "Accept") { if($name == "Accept") {
$accepts = explode(',', $value); $accepts = explode(',', $value);
if(in_array("application/json", $accepts)) { if(in_array("application/json", $accepts)) {
$requests['_JSON'] = json_decode(file_get_contents('php://input')); $requests['_JSON'] = json_decode($requests['_RAW']);
} }
break; break;
} }
@ -67,7 +68,7 @@ if(!function_exists("read_requests")) {
// check if seal(serialize) request // check if seal(serialize) request
if(array_key_equals("unserialize", $options, true)) { if(array_key_equals("unserialize", $options, true)) {
$requests['_SEAL'] = unserialize(file_get_contents('php://input')); $requests['_SEAL'] = unserialize($requests['_RAW']);
} }
// with security module // with security module
@ -87,6 +88,7 @@ if(!function_exists("read_requests")) {
"get" => "_GET", "get" => "_GET",
"uri" => "_URI", "uri" => "_URI",
"files" => "_FILES", "files" => "_FILES",
"raw" => "_RAW",
"json" => "_JSON", "json" => "_JSON",
"seal" => "_SEAL" "seal" => "_SEAL"
); );