expects json

This commit is contained in:
Taylor Otwell 2016-06-22 08:48:58 -05:00
parent 51addd6c63
commit b787586514
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ public function render($request, Exception $e)
*/
protected function unauthenticated($request, AuthenticationException $e)
{
if ($request->ajax() || $request->wantsJson()) {
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
return redirect()->guest('login');