diff --git a/src/Middleware/InertiaMiddleware.php b/src/Middleware/InertiaMiddleware.php index 34d56c2..0261337 100644 --- a/src/Middleware/InertiaMiddleware.php +++ b/src/Middleware/InertiaMiddleware.php @@ -21,12 +21,12 @@ class InertiaMiddleware implements MiddlewareInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { - if (!$request->hasHeader('X-Inertia')) { - return $handler->handle($request); - } if ($request instanceof ServerRequest) { $this->setupDetectors($request); } + if (!$request->hasHeader('X-Inertia')) { + return $handler->handle($request); + } $response = $handler->handle($request); if ( diff --git a/tests/TestCase/View/InertiaJsonViewTest.php b/tests/TestCase/View/InertiaJsonViewTest.php index be8bd47..f30b5c4 100644 --- a/tests/TestCase/View/InertiaJsonViewTest.php +++ b/tests/TestCase/View/InertiaJsonViewTest.php @@ -10,6 +10,8 @@ class InertiaJsonViewTest extends TestCase { + public $View; + public function setUp(): void { parent::setUp();