Skip to content

Commit b5093c4

Browse files
committed
tests: try fix test
1 parent 4473aff commit b5093c4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

system/Debug/Toolbar.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,22 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
390390
}
391391

392392
$config = config(ToolbarConfig::class);
393+
394+
try {
395+
$stats = $app->getPerformanceStats();
396+
if (! isset($stats['startTime']) || ! isset($stats['totalTime'])) {
397+
return;
398+
}
399+
} catch (\Throwable $e) {
400+
return;
401+
}
402+
403+
foreach ($config->disableOnHeaders as $header) {
404+
if ($request->hasHeader($header)) {
405+
$this->isCustomAjax = true;
406+
break;
407+
}
408+
}
393409

394410
$toolbar = service('toolbar', $config);
395411
$stats = $app->getPerformanceStats();
@@ -413,13 +429,6 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
413429

414430
$format = $response->getHeaderLine('content-type');
415431

416-
foreach ($config->disableOnHeaders as $header) {
417-
if ($request->hasHeader($header)) {
418-
$this->isCustomAjax = true;
419-
break;
420-
}
421-
}
422-
423432
// Non-HTML formats should not include the debugbar
424433
// then we send headers saying where to find the debug data
425434
// for this response

0 commit comments

Comments
 (0)