We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28f8282 commit 89dc2f3Copy full SHA for 89dc2f3
src/Middleware/MinifyResponse.php
@@ -21,10 +21,23 @@ public function handle($request, Closure $next)
21
/** @var Response $response */
22
$response = $next($request);
23
24
- if (!app()->isLocal() and false === is_a($response, StreamedResponse::class)) {
+ if (!app()->isLocal() && $this->isHtml($response)) {
25
$response->setContent((new Minifier())->html($response->getContent()));
26
}
27
28
return $response;
29
30
+
31
+ /**
32
+ * Check if the content type header is html.
33
+ *
34
+ * @param \Illuminate\Http\Response $response
35
36
+ * @return bool
37
+ */
38
+ protected function isHtml($response)
39
+ {
40
+ $type = $response->headers->get('Content-Type');
41
+ return strtolower(strtok($type, ';')) === 'text/html';
42
+ }
43
0 commit comments