public function handle($request, $next)
{
if ($request->has('_tracy_bar') === true) {
$tracyBar = $request->get('_tracy_bar');
switch ($tracyBar) {
case 'css':
$content = $this->debugbar->dispatchAssets();
$headers = ['content-type' => 'text/css; charset=utf-8', 'cache-control' => 'max-age=86400'];
break;
case 'js':
case 'assets':
$content = $this->debugbar->dispatchAssets();
$headers = ['content-type' => 'text/javascript; charset=utf-8', 'cache-control' => 'max-age=86400'];
break;
default:
$content = $this->debugbar->dispatch();
$headers = ['content-type' => 'text/javascript; charset=utf-8'];
break;
}
return $this->sendStreamedResponse($content, array_merge($headers, ['content-length' => strlen($content)]));
}
$this->debugbar->dispatch();
return $next($request);
}