mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-15 03:38:50 +01:00
Fixed exception if no content type or accept header are given
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user