summaryrefslogtreecommitdiff
path: root/src/Middleware
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-11-20 18:57:11 +0100
committermsquare <msquare@notrademark.de>2019-06-12 10:20:08 +0200
commit93e578e555b6e40c1e26d85e4f32b87577f54def (patch)
tree0a14f4a1910d646c3b21cebf4494d3f0bf75486f /src/Middleware
parent1f433694d25fc6d9e9d82ae725b618531b313aac (diff)
Added html content sniffer
Diffstat (limited to 'src/Middleware')
-rw-r--r--src/Middleware/ErrorHandler.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Middleware/ErrorHandler.php b/src/Middleware/ErrorHandler.php
index 9fc34722..29b1fac1 100644
--- a/src/Middleware/ErrorHandler.php
+++ b/src/Middleware/ErrorHandler.php
@@ -48,6 +48,10 @@ class ErrorHandler implements MiddlewareInterface
$statusCode = $response->getStatusCode();
$contentType = $response->getHeader('content-type');
$contentType = array_shift($contentType);
+ if (!$contentType && strpos($response->getBody(), '<html') !== false) {
+ $contentType = 'text/html';
+ }
+
if (
$statusCode < 400
|| !$response instanceof Response