Skip to content

Commit

Permalink
use built in request format instead of custom method
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoiriert committed Nov 1, 2018
1 parent 94a7ea7 commit 4d81503
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions EventListener/ApiExceptionSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d81503

Please sign in to comment.