mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed exception if no content type or accept header are given
This commit is contained in:
parent
2861f4fdb8
commit
ee3ad403fb
1 changed files with 11 additions and 1 deletions
|
@ -74,6 +74,16 @@ class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
|
||||||
$contentType = $request->headers->get('Content-Type');
|
$contentType = $request->headers->get('Content-Type');
|
||||||
$accept = $request->headers->get('Accept');
|
$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;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue