add status text to web profiler response panel
This commit is contained in:
parent
f66e109d14
commit
b0bca01ce3
@ -16,15 +16,15 @@
|
||||
{% set request_route = collector.route ? collector.route : 'NONE' %}
|
||||
{% set icon %}
|
||||
<img width="28" height="28" alt="Request" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAQAAADYBBcfAAACvElEQVR42tVTbUhTYRTerDCnKVoUUr/KCZmypA9Koet0bXNLJ5XazDJ/WFaCUY0pExRZXxYiJgsxWWjkaL+yK+po1gjyR2QfmqWxtBmaBtqWGnabT++c11Fu4l/P4VzOPc95zoHznsNZodIbLDdRcKnc1Bu8DAK45ZsOnykQNMopsNooLxCknb0cDq5vml9FtHiIgpBR0R6iihYyFMTDt2Lg56ObPkI6TMGXSof1EV67IqCwisJSWliFAG/E0CfFIiebdNypcxi/1zgyFiIiZ3sJQr0RQx5frLa6k7SOKRo3oMFNR5t62h2rttKXEOKFqDCxtXNmmBokO2KKTlp3IdWuT2dYRNGKwEXEBCcL172G5FG0aIxC0kR9PBTVH1kkwQn+IqJnCE33EalVzT9GJQS1tAdD3CKicJYFrxqx7W2ejCEdZy1FiC5tZxHhLJKOZaRdQJAyV/YAvDliySALHxmxR4Hqe2iwvaOR/CEuZYJFSgYhVbZRkA8KGdEktrqnqra90NndCdkt77fjIHIhexOrfO6O3bbbOj/rqu5IptgyR3sU93QbOYhquZK4MCDp0Ina/PLsu5JvbCTRaapUdUmIV/RzoMdsk/0hWRNdAvKOmvqlN0drsJbJf1P4YsQ5lGrJeuosiOUgbOC8cto3LfOXTdVd7BqZsQKbse+0jUL6WPcesqs4MNSUTQAxGjwFiC8m3yzmqwHJBWYKBJ9WNqW/dHkpU/osch1Yj5RJfXPfSEe/2UPsN490NPfZG5CKyJmcV5ayHyzy7BMqsXfuHhGK/cjAIeSpR92gehR55D8TcQhDEKJwytBJ4fr4NULvrEM8NszfJPyxDoHYAQ1oPCWmIX4gifmDS/DV2DKeb25FHWr76yEG7/9L4YFPeiQQ4/8LkgJ8Et+NncTCsYqzXAEXa7CWdPZzGWdlyV+vST0JanfPvwAAAABJRU5ErkJggg==">
|
||||
<span class="sf-toolbar-status sf-toolbar-status-{{ request_status_code_color }}">{{ collector.statuscode }}</span>
|
||||
<span class="sf-toolbar-status sf-toolbar-status-{{ request_status_code_color }}" title="{{ collector.statustext }}">{{ collector.statuscode }}</span>
|
||||
<span class="sf-toolbar-status sf-toolbar-info-piece-additional">{{ request_handler }}</span>
|
||||
<span class="sf-toolbar-info-piece-additional-detail">on <i>{{ request_route }}</i></span>
|
||||
{% endset %}
|
||||
{% set text %}
|
||||
{% spaceless %}
|
||||
<div class="sf-toolbar-info-piece">
|
||||
<b>Status Code</b>
|
||||
<span class="sf-toolbar-status sf-toolbar-status-{{ request_status_code_color }}">{{ collector.statuscode }}</span>
|
||||
<b>Status</b>
|
||||
<span class="sf-toolbar-status sf-toolbar-status-{{ request_status_code_color }}">{{ collector.statuscode }}</span> {{ collector.statustext }}
|
||||
</div>
|
||||
<div class="sf-toolbar-info-piece">
|
||||
<b>Controller</b>
|
||||
|
@ -79,11 +79,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
}
|
||||
}
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
|
||||
$this->data = array(
|
||||
'format' => $request->getRequestFormat(),
|
||||
'content' => $content,
|
||||
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html',
|
||||
'status_code' => $response->getStatusCode(),
|
||||
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
|
||||
'status_code' => $statusCode,
|
||||
'request_query' => $request->query->all(),
|
||||
'request_request' => $request->request->all(),
|
||||
'request_headers' => $request->headers->all(),
|
||||
@ -195,6 +198,11 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
return $this->data['content_type'];
|
||||
}
|
||||
|
||||
public function getStatusText()
|
||||
{
|
||||
return $this->data['status_text'];
|
||||
}
|
||||
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->data['status_code'];
|
||||
|
@ -50,6 +50,7 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('en',$c->getLocale());
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
|
||||
$this->assertEquals('OK',$c->getStatusText());
|
||||
$this->assertEquals(200,$c->getStatusCode());
|
||||
$this->assertEquals('application/json',$c->getContentType());
|
||||
}
|
||||
|
Reference in New Issue
Block a user