diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-12-18 02:16:25 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-12-19 22:36:42 +0100 |
commit | 3c8d0eeb440b8c263686ba81df7be87290ad9695 (patch) | |
tree | 5c7c944be88d8b9808ae53a8db31a1ec10c56346 /src/Middleware | |
parent | 2570418e9ff95ebffdaabb4945ec611104891849 (diff) |
ErrorHandler: Don't wrap the response if a content-type is defined
Diffstat (limited to 'src/Middleware')
-rw-r--r-- | src/Middleware/ErrorHandler.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Middleware/ErrorHandler.php b/src/Middleware/ErrorHandler.php index c99ac24f..9fc34722 100644 --- a/src/Middleware/ErrorHandler.php +++ b/src/Middleware/ErrorHandler.php @@ -46,7 +46,13 @@ class ErrorHandler implements MiddlewareInterface } $statusCode = $response->getStatusCode(); - if ($statusCode < 400 || !$response instanceof Response) { + $contentType = $response->getHeader('content-type'); + $contentType = array_shift($contentType); + if ( + $statusCode < 400 + || !$response instanceof Response + || !empty($contentType) + ) { return $response; } |