Browse Source

Do not run CSRF middleware on JSON Accept header

master
Les De Ridder 3 years ago
parent
commit
3416f731e7
  1. 9
      app/Http/Middleware/VerifyCsrfToken.php

9
app/Http/Middleware/VerifyCsrfToken.php

@ -21,4 +21,13 @@ class VerifyCsrfToken extends Middleware
protected $except = [
//
];
public function handle($request, \Closure $next)
{
if($request->format() == 'json') {
return $next($request);
} else {
return parent::handle($request, $next);
}
}
}
Loading…
Cancel
Save