diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 2d4386017..dcd9c27a8 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -1407,14 +1407,13 @@ class Uri */ public function getContentType($short = true) { - if (isset($_SERVER['CONTENT_TYPE'])) { - $content_type = $_SERVER['CONTENT_TYPE']; + $content_type = $_SERVER['CONTENT_TYPE'] ?? $_SERVER['HTTP_CONTENT_TYPE'] ?? $_SERVER['HTTP_ACCEPT'] ?? null; + if ($content_type) { if ($short) { return Utils::substrToString($content_type, ';'); } - return $content_type; } - return null; + return $content_type; } /** diff --git a/system/src/Grav/Framework/Flex/FlexCollection.php b/system/src/Grav/Framework/Flex/FlexCollection.php index cfa91008e..3e9302cb8 100644 --- a/system/src/Grav/Framework/Flex/FlexCollection.php +++ b/system/src/Grav/Framework/Flex/FlexCollection.php @@ -440,7 +440,8 @@ class FlexCollection extends ObjectCollection implements FlexCollectionInterface ] + $context ); - if ($debugger->enabled() && $grav['uri']->getContentType() !== 'application/json') { + if ($debugger->enabled() && + !($grav['uri']->getContentType() === 'application/json' || $grav['uri']->extension() === 'json')) { $output = "\n\n{$output}\n\n"; } diff --git a/system/src/Grav/Framework/Flex/FlexObject.php b/system/src/Grav/Framework/Flex/FlexObject.php index 58bd7eb4d..14f28f9b6 100644 --- a/system/src/Grav/Framework/Flex/FlexObject.php +++ b/system/src/Grav/Framework/Flex/FlexObject.php @@ -627,7 +627,8 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface ] + $context ); - if ($debugger->enabled() && $grav['uri']->getContentType() !== 'application/json') { + if ($debugger->enabled() && + !($grav['uri']->getContentType() === 'application/json' || $grav['uri']->extension() === 'json')) { $name = $this->getKey() . ' (' . $type . ')'; $output = "\n\n{$output}\n\n"; }