diff --git a/html/components/basic-func/external-libs.html b/html/components/basic-func/external-libs.html index c3f74b8f..e69de29b 100644 --- a/html/components/basic-func/external-libs.html +++ b/html/components/basic-func/external-libs.html @@ -1 +0,0 @@ - diff --git a/includes/common_func.php b/includes/common_func.php index 95f24086..62f69d0f 100644 --- a/includes/common_func.php +++ b/includes/common_func.php @@ -149,15 +149,20 @@ function getRequest() { // This function also needs to handle preflight for CORS if ($_SERVER['REQUEST_METHOD'] !== 'OPTIONS') { // This is not a CORS preflight request - if(isset($_SERVER['HTTP_CONTENT_TYPE'])) { - switch(explode('; ', strtolower($_SERVER['HTTP_CONTENT_TYPE']), 2)[0]) { + $contentType = isset($_SERVER['HTTP_CONTENT_TYPE']) + ? $_SERVER['HTTP_CONTENT_TYPE'] + : isset($_SERVER['CONTENT_TYPE']) + ? $_SERVER['CONTENT_TYPE'] + : ''; + if($contentType) { + switch(explode('; ', strtolower($contentType), 2)[0]) { case 'application/json': return json_decode(file_get_contents('php://input'), true); case 'application/x-www-form-urlencoded': case 'multipart/form-data': return $_REQUEST; default: - error_log('Content-type not recognized: get \'' . $_SERVER['HTTP_CONTENT_TYPE'] . '\''); + error_log('Content-type not recognized: get \'' . $contentType . '\''); return file_get_contents('php://input'); } } else {