Do not run CSRF middleware on JSON Accept header

This commit is contained in:
Les De Ridder 2018-10-22 23:58:28 +02:00
parent 1cdbec7d5e
commit 3416f731e7
1 changed files with 9 additions and 0 deletions

View File

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