Skip to content

Commit f8267cb

Browse files
authored
Merge pull request #5701 from zl59503020/patch-9
fix: debug toolbar vars response headers includes request headers
2 parents 93b8bca + 82adc8b commit f8267cb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

system/Debug/Toolbar.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,13 @@ public function run(float $startTime, float $totalTime, RequestInterface $reques
151151
'statusCode' => $response->getStatusCode(),
152152
'reason' => esc($response->getReasonPhrase()),
153153
'contentType' => esc($response->getHeaderLine('content-type')),
154+
'headers' => [],
154155
];
155156

157+
foreach ($response->headers() as $header) {
158+
$data['vars']['response']['headers'][esc($header->getName())] = esc($header->getValueLine());
159+
}
160+
156161
$data['config'] = Config::display();
157162

158163
if ($response->CSP !== null) {

system/Debug/Toolbar/Views/toolbar.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
<span>( <?= $vars['response']['statusCode'] . ' - ' . $vars['response']['reason'] ?> )</span>
240240
</h2>
241241

242-
<?php if (isset($vars['headers']) && $headers = $vars['headers']) : ?>
242+
<?php if (isset($vars['response']['headers']) && $headers = $vars['response']['headers']) : ?>
243243
<a href="javascript:void(0)" onclick="ciDebugBar.toggleDataTable('response_headers'); return false;">
244244
<h3>Headers</h3>
245245
</a>

0 commit comments

Comments
 (0)