8000 feature #35391 [WebProfilerBundle][HttpClient] Added profiler links i… · symfony/symfony@c4d15bc · GitHub
[go: up one dir, main page]

Skip to content

Commit c4d15bc

Browse files
committed
feature #35391 [WebProfilerBundle][HttpClient] Added profiler links in the Web Profiler -> Http Client panel (cristagu)
This PR was squashed before being merged into the 5.1-dev branch (closes #35391). Discussion ---------- [WebProfilerBundle][HttpClient] Added profiler links in the Web Profiler -> Http Client panel | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | [#33311](#33311) | License | MIT | Doc PR | - As per @Neirda24's idea in this [comment](#33311 (comment)), I parsed the response headers collected by the TraceableHttpClient and created profiler links in the HttpClient Web Profiler panel for all the requests having the 'X-Debug-Token' header. ![profiler](https://user-images.githubusercontent.com/26301369/72686050-19a91300-3af9-11ea-998b-db063a3aa358.PNG) Commits ------- 70e11f9 [WebProfilerBundle][HttpClient] Added profiler links in the Web Profiler -> Http Client panel
2 parents 9f93a38 + 70e11f9 commit c4d15bc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@
5454
{% else %}
5555
<h4>Requests</h4>
5656
{% for trace in client.traces %}
57+
{% set profiler_token = '' %}
58+
{% set profiler_link = '' %}
59+
{% if trace.info.response_headers is defined %}
60+
{% for header in trace.info.response_headers %}
61+
{% if header matches '/^x-debug-token: .*$/i' %}
62+
{% set profiler_token = (header.getValue | slice('x-debug-token: ' | length)) %}
63+
{% endif %}
64+
{% if header matches '/^x-debug-token-link: .*$/i' %}
65+
{% set profiler_link = (header.getValue | slice('x-debug-token-link: ' | length)) %}
66+
{% endif %}
67+
{% endfor %}
68+
{% endif %}
5769
<table>
5870
<thead>
5971
<tr>
@@ -66,6 +78,11 @@
6678
{{ profiler_dump(trace.options, maxDepth=1) }}
6779
{% endif %}
6880
</th>
81+
{% if profiler_token and profiler_link %}
82+
<th>
83+
Profile
84+
</th>
85+
{% endif %}
6986
</tr>
7087
</thead>
7188
<tbody>
@@ -85,6 +102,11 @@
85102
<td>
86103
{{ profiler_dump(trace.info, maxDepth=1) }}
87104
</td>
105+
{% if profiler_token and profiler_link %}
106+
<td>
107+
<span><a href="{{ profiler_link }}" target="_blank">{{ profiler_token }}</a></span>
108+
</td>
109+
{% endif %}
88110
</tr>
89111
</tbody>
90112
</table>

0 commit comments

Comments
 (0)
0