Skip to content

Commit 78ab00d

Browse files
wip
1 parent 51dac55 commit 78ab00d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/router/src/Exceptions/HttpExceptionHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Tempest\Core\Kernel;
1111
use Tempest\Http\GenericResponse;
1212
use Tempest\Http\HttpRequestFailed;
13+
use Tempest\Http\Request;
1314
use Tempest\Http\Response;
1415
use Tempest\Http\Responses\Json;
1516
use Tempest\Http\Session\CsrfTokenDidNotMatch;
@@ -19,6 +20,7 @@
1920
use Tempest\View\GenericView;
2021
use Throwable;
2122

23+
use function Tempest\get;
2224
use function Tempest\Support\arr;
2325

2426
final readonly class HttpExceptionHandler implements ExceptionHandler
@@ -52,7 +54,7 @@ public function handle(Throwable $throwable): void
5254

5355
private function renderErrorResponse(Status $status, ?HttpRequestFailed $exception = null): Response
5456
{
55-
if ($exception->request->headers->get('Accept') === 'application/json') {
57+
if (get(Request::class)->headers->get('Accept') === 'application/json') {
5658
return new Json(
5759
$this->appConfig->environment->isLocal() && $exception !== null
5860
? [

0 commit comments

Comments
 (0)