Skip to content

Commit

Permalink
refactor JsonResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencei committed Apr 10, 2017
1 parent 84506c1 commit bf5d8c4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Psr\Log\LoggerInterface;
use Illuminate\Http\Response;
use Illuminate\Routing\Router;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Auth\AuthenticationException;
Expand Down Expand Up @@ -212,7 +213,7 @@ protected function prepareResponse($request, Exception $e)
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Symfony\Component\HttpFoundation\Response
* @return \Illuminate\Http\JsonResponse
*/
protected function prepareJsonResponse($request, Exception $e)
{
Expand All @@ -233,9 +234,7 @@ protected function prepareJsonResponse($request, Exception $e)
];
}

return response(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), $status, array_merge($headers, [
'Content-Type' => 'application/json',
]));
return new JsonResponse($response, $status, $headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
}

/**
Expand Down

0 comments on commit bf5d8c4

Please sign in to comment.