API route does not work after adding middleware

0

500 server error:

  

POST link 500 (Internal Server Error)

The route and the controller work perfectly without middleware (although this is without extra logic)

Route::post('sessiondata2', 'sessionController@consularSessionYActividad')->middleware('isjson');

Middleware

<?php

namespace App\Http\Middleware;

use Closure;

class isjson
{
/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Closure  $next
 * @return mixed
 */
public function handle($request, Closure $next)
{
    return $next($request);
}
}

Middleware in web routes work well, what is different with the routes api?

I also tried to add the middleware by grouping routes but it gives me the same error.

    
asked by César Alejandro M 21.06.2018 в 16:29
source

0 answers