fix: force JSON responses on /api/* routes
This commit is contained in:
+5
-1
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user