From 4d81503bd001a7db12d3681e7ae6123b8937ee47 Mon Sep 17 00:00:00 2001 From: Martin Poirier-Theoret Date: Thu, 1 Nov 2018 16:49:03 -0400 Subject: [PATCH] use built in request format instead of custom method --- EventListener/ApiExceptionSubscriber.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/EventListener/ApiExceptionSubscriber.php b/EventListener/ApiExceptionSubscriber.php index e4f2ba9..d87d15f 100644 --- a/EventListener/ApiExceptionSubscriber.php +++ b/EventListener/ApiExceptionSubscriber.php @@ -150,17 +150,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) */ private function getFormat(Request $request) { - $acceptKey = null; - if ($request->headers->has('Accept')) { - $acceptKey = 'Accept'; - } - if ($request->headers->has('accept')) { - $acceptKey = 'accept'; - } - if (strstr($request->headers->get($acceptKey), 'json')) { - return 'json'; - } - return 'other'; + return $request->getRequestFormat(); } public function getExceptionDetail($e, $full = true)