Integrated
Integrated copied to clipboard
Using TerminableMiddleware 'terminate' functions is not called
Working with Laravel.
It's kind of weird but if I use the TerminableMiddleware Implementation the terminate function is not called. I thought I was doing something wrong and it could lead to wasted time trying to figure the problem in other context.
class CustomMiddleware implements TerminableMiddleware {
public function handle($request, Closure $next)
{
$response = $next($request);
return $response;
}
public function terminate($request, $response)
{
Query::createFromRequestResponse($request, $response);
}
}
Of course, I can recreate the same behaviour using the handle function.
class CustomMiddleware {
public function handle($request, Closure $next)
{
$response = $next($request);
Query::createFromRequestResponse($request, $response);
return $response;
}
}