Updated system so that NotFoundDelegate is used

This commit is contained in:
Alejandro Celaya
2018-03-26 20:37:04 +02:00
parent 3dcc510da1
commit 6935b2ebe2
2 changed files with 5 additions and 4 deletions

View File

@@ -39,12 +39,12 @@ class NotFoundDelegate implements DelegateInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$accepts = explode(',', $request->getHeaderLine('Accept'));
$accept = array_shift($accepts);
$accepts = \explode(',', $request->getHeaderLine('Accept'));
$accept = \array_shift($accepts);
$status = StatusCodeInterface::STATUS_NOT_FOUND;
// If the first accepted type is json, return a json response
if (in_array($accept, ['application/json', 'text/json', 'application/x-json'], true)) {
if (\in_array($accept, ['application/json', 'text/json', 'application/x-json'], true)) {
return new Response\JsonResponse([
'error' => 'NOT_FOUND',
'message' => 'Not found',