File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,13 @@ public function header(string $header): string|array|null
496
496
*/
497
497
public function isJson (): bool
498
498
{
499
- return str_contains ($ this ->header ('Content-Type ' ), 'json ' );
499
+ $ contentType = $ this ->header ('Content-Type ' );
500
+
501
+ if (is_null ($ contentType )) {
502
+ return false ;
503
+ }
504
+
505
+ return str_contains ($ contentType , 'json ' );
500
506
}
501
507
502
508
/**
@@ -506,7 +512,13 @@ public function isJson(): bool
506
512
*/
507
513
public function isXml (): bool
508
514
{
509
- return str_contains ($ this ->header ('Content-Type ' ), 'xml ' );
515
+ $ contentType = $ this ->header ('Content-Type ' );
516
+
517
+ if (is_null ($ contentType )) {
518
+ return false ;
519
+ }
520
+
521
+ return str_contains ($ contentType , 'xml ' );
510
522
}
511
523
512
524
/**
You can’t perform that action at this time.
0 commit comments