Skip to content

Commit 41df91e

Browse files
authored
Only add server timing on ajax, when enabled
1 parent 6b2f13f commit 41df91e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/LaravelDebugbar.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ public function modifyResponse(Request $request, Response $response)
648648
) {
649649
try {
650650
$this->sendDataInHeaders(true);
651+
652+
if ($app['config']->get('debugbar.add_ajax_timing', false)) {
653+
$this->addServerTimingHeaders($response);
654+
}
655+
651656
} catch (\Exception $e) {
652657
$app['log']->error('Debugbar exception: ' . $e->getMessage());
653658
}
@@ -670,7 +675,7 @@ public function modifyResponse(Request $request, Response $response)
670675
}
671676
}
672677

673-
$this->addServerTimingHeaders($response);
678+
674679

675680
return $response;
676681
}
@@ -979,6 +984,7 @@ protected function addServerTimingHeaders(Response $response)
979984
if ($this->hasCollector('time')) {
980985
$collector = $this->getCollector('time');
981986

987+
$headers = [];
982988
foreach ($collector->collect()['measures'] as $k => $m) {
983989
$headers[] = sprintf('%d=%F; "%s"', $k, $m['duration'], str_replace('"', "'", $m['label']));
984990
}

0 commit comments

Comments
 (0)