Permalink
Browse files

Not all PHP servers define CONTENT_TYPE key in $_SERVER object

  • Loading branch information...
sergeychernyshev committed Jun 5, 2017
1 parent 324894b commit 8ff38f4b5df79f08460de61f59cf231393104e53
Showing with 5 additions and 3 deletions.
  1. +5 −3 api.php
View
@@ -107,10 +107,12 @@
// ignore encoding header when comparing format
// TODO: might need to test how it behaves with multibyte payload
$content_type = explode(';', $_SERVER['CONTENT_TYPE'])[0];
if (array_key_exists('CONTENT_TYPE', $_SERVER)) {
$content_type = explode(';', $_SERVER['CONTENT_TYPE'])[0];
if (!empty($raw_request_body) && strtolower($content_type) == 'application/x-www-form-urlencoded') {
$params = \StartupAPI\API\Endpoint::parseURLEncoded($raw_request_body, $params);
if (!empty($raw_request_body) && strtolower($content_type) == 'application/x-www-form-urlencoded') {
$params = \StartupAPI\API\Endpoint::parseURLEncoded($raw_request_body, $params);
}
}
unset($params['call']); // except for the call parameter

0 comments on commit 8ff38f4

Please sign in to comment.