diff --git a/src/Middleware/InjectScriptsMiddleware.php b/src/Middleware/InjectScriptsMiddleware.php index 5c6f35b..e2a29d6 100644 --- a/src/Middleware/InjectScriptsMiddleware.php +++ b/src/Middleware/InjectScriptsMiddleware.php @@ -7,6 +7,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Str; class InjectScriptsMiddleware { @@ -17,6 +18,7 @@ public function handle(Request $request, Closure $next) if ( Cache::get('serve_websockets_running') === true && $request->getMethod() === Request::METHOD_GET + && Str::startsWith($response->headers->get('Content-Type'), 'text/html') && !$request->isXmlHttpRequest() && !$response instanceof JsonResponse ) {