Merge branch 'develop' into feature/v1.8

This commit is contained in:
Andy Miller
2024-10-22 15:47:58 +01:00
3 changed files with 7 additions and 6 deletions

View File

@@ -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;
}
/**

View File

@@ -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<! START {$type} collection >\n{$output}\n<! END {$type} collection >\n";
}

View File

@@ -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<! START {$name} object >\n{$output}\n<! END {$name} object >\n";
}