From d459dca21a10e73f9ccfe66849109b2092067ade Mon Sep 17 00:00:00 2001 From: bangnokia Date: Thu, 6 May 2021 23:28:40 +0700 Subject: [PATCH] fix bug when js resolve via php --- src/Middleware/InjectScriptsMiddleware.php | 2 ++ 1 file changed, 2 insertions(+) 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 ) {