diff --git a/code/SS_RelativeAssetsResponse.php b/code/SS_RelativeAssetsResponse.php index dcadfcd..6fd776e 100644 --- a/code/SS_RelativeAssetsResponse.php +++ b/code/SS_RelativeAssetsResponse.php @@ -25,9 +25,12 @@ public function setBody($body) $body = str_replace('"/assets/', '"assets/', $body); $body = str_replace('"assets/', '"/assets/', $body); + + json_decode($body); + $bodyIsJson = json_last_error() === JSON_ERROR_NONE; - if (class_exists('zz\Html\HTMLMinify')) { + if (!$bodyIsJson && class_exists('zz\Html\HTMLMinify')) { $this->body = zz\Html\HTMLMinify::minify($body, [ 'doctype' => zz\Html\HTMLMinify::DOCTYPE_HTML5, 'optimizationLevel' => zz\Html\HTMLMinify::OPTIMIZATION_ADVANCED