Back

Set status text with abort function


  • Laravel Version: 5.5.14
  • PHP Version: 7.1.10

Description:

When I try to POST with X-Requested-With='XMLHttpRequest' without CSRF-TOKEN I receive null message in response. I add this code to App\Exceptions\Handler:

public function render($request, Exception $exception)
{
    if($exception instanceof TokenMismatchException) {
        abort(419, 'Token Mismatch OR page has expired due to inactivity.');
    }
    return parent::render($request, $exception);
}

Now I have Token Mismatch OR page has expired due to inactivity. message in response, but status text is: unknown status.

How can I set status text?


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us