Skip to content

Commit

Permalink
Update common_func.php
Browse files Browse the repository at this point in the history
Fixed an issue when migrating to nginx
  • Loading branch information
Xiaoyi Cao committed Jan 17, 2019
1 parent 11e1f7e commit 6fd0c71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/common_func.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ 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['CONTENT_TYPE'])) {
switch(explode('; ', strtolower($_SERVER['CONTENT_TYPE']), 2)[0]) {
if(isset($_SERVER['HTTP_CONTENT_TYPE'])) {
switch(explode('; ', strtolower($_SERVER['HTTP_CONTENT_TYPE']), 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['CONTENT_TYPE'] . '\'');
error_log('Content-type not recognized: get \'' . $_SERVER['HTTP_CONTENT_TYPE'] . '\'');
return file_get_contents('php://input');
}
} else {
Expand Down

0 comments on commit 6fd0c71

Please sign in to comment.