diff --git a/Message/Http/Response.php b/Message/Http/Response.php index 0b8a5020a..1a0569606 100644 --- a/Message/Http/Response.php +++ b/Message/Http/Response.php @@ -140,6 +140,12 @@ class Response extends ResponseAbstract implements RenderableInterface throw new \Exception('Wrong response type'); } } + + $types = $this->header->get('Content-Type'); + + if(in_array(MimeType::M_HTML, $types)) { + return trim(preg_replace('/(\s{2,}|\n)(?![^<>]*<\/pre>)/', ' ', $render); + } return $render; }