Fixed exception if no content type or accept header are given

This commit is contained in:
Jan Böhmer 2024-01-26 00:36:14 +01:00
parent 2861f4fdb8
commit ee3ad403fb

View file

@ -74,6 +74,16 @@ class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
$contentType = $request->headers->get('Content-Type');
$accept = $request->headers->get('Accept');
return str_contains($contentType, 'json') || str_contains($accept, 'json');
$tmp = false;
if ($contentType !== null) {
$tmp = str_contains($contentType, 'json');
}
if ($accept !== null) {
$tmp = $tmp || str_contains($accept, 'json');
}
return $tmp;
}
}