Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a0e8af

Browse files
committed
[WebProfilerBundle] show the http method in wdt if not 'GET'
When the request method is different from 'GET', the wdt add a hint before the route name in the request panel.
1 parent 4f020b5 commit 0a0e8af

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
{% if collector.route %}
2828
{% if collector.redirect %}{{ include('@WebProfiler/Icon/redirect.svg') }}{% endif %}
2929
{% if collector.forward %}{{ include('@WebProfiler/Icon/forward.svg') }}{% endif %}
30-
<span class="sf-toolbar-label">@</span>
30+
<span class="sf-toolbar-label">{{ 'GET' != collector.method ? collector.method }} @</span>
3131
<span class="sf-toolbar-value sf-toolbar-info-piece-additional">{{ collector.route }}</span>
3232
{% endif %}
3333
{% endset %}
@@ -39,6 +39,13 @@
3939
<span>{{ collector.statuscode }} {{ collector.statustext }}</span>
4040
</div>
4141

42+
{% if 'GET' != collector.method -%}
43+
<div class="sf-toolbar-info-piece">
44+
<b>Method</b>
45+
<span>{{ collector.method }}</span>
46+
</div>
47+
{%- endif %}
48+
4249
<div class="sf-toolbar-info-piece">
4350
<b>Controller</b>
4451
<span>{{ request_handler }}</span>

src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function collect(Request $request, Response $response, \Exception $except
9090
$statusCode = $response->getStatusCode();
9191

9292
$this->data = array(
93+
'method' => $request->getMethod(),
9394
'format' => $request->getRequestFormat(),
9495
'content' => $content,
9596
'content_type' => $response->headers->get('Content-Type', 'text/html'),
@@ -156,6 +157,11 @@ public function collect(Request $request, Response $response, \Exception $except
156157
}
157158
}
158159

160+
public function getMethod()
161+
{
162+
return $this->data['method'];
163+
}
164+
159165
public function getPathInfo()
160166
{
161167
return $this->data['path_info'];

0 commit comments

Comments
 (0)