jeudi 12 octobre 2017

set status text with abort function

  • Laravel Version: 5.5.14
  • PHP Version: 7.1.10

Description:

Hello all. 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 write status text?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire