fix: force JSON responses on /api/* routes

This commit is contained in:
2026-05-07 19:36:46 +00:00
parent 74c6bcb9f1
commit 1df7361d7e
+5 -1
View File
@@ -41,5 +41,9 @@ return Application::configure(basePath: dirname(__DIR__))
]); ]);
}) })
->withExceptions(function (Exceptions $exceptions): void { ->withExceptions(function (Exceptions $exceptions): void {
// // Force JSON responses on /api/* even when client did not send Accept: json.
$exceptions->shouldRenderJsonWhen(function (Request $request, \Throwable $e) {
if ($request->is('api/*')) return true;
return $request->expectsJson();
});
})->create(); })->create();