Add result optimization for html

This commit is contained in:
Dennis Eichhorn 2017-10-24 16:33:35 +02:00 committed by GitHub
parent 7c24bdbbcc
commit 79f5b646dc

View File

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