We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef49b82 commit 9d45946Copy full SHA for 9d45946
1 file changed
src/Http/Request.php
@@ -424,6 +424,23 @@ public function isAjax(): bool
424
return false;
425
}
426
427
+ public function wantsJson(): bool
428
+ {
429
+ $accept = $this->getHeader('accept');
430
+
431
+ if ($accept && str_contains($accept, 'application/json')) {
432
+ return true;
433
+ }
434
435
+ $content_type = $this->getHeader('content-type');
436
437
+ if ($content_type && str_contains($content_type, 'application/json')) {
438
439
440
441
+ return false;
442
443
444
/**
445
* Check if a url matches with the pattern
446
*
0 commit comments