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](https://github.com/symfony/symfony/issues/33311)
| License | MIT
| Doc PR | -
As per @Neirda24's idea in this [comment](https://github.com/symfony/symfony/issues/33311#issuecomment-524612722), 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
-------
70e11f9f3d
[WebProfilerBundle][HttpClient] Added profiler links in the Web Profiler -> Http Client panel
This commit is contained in:
commit
c4d15bc386
@ -54,6 +54,18 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<h4>Requests</h4>
|
<h4>Requests</h4>
|
||||||
{% for trace in client.traces %}
|
{% for trace in client.traces %}
|
||||||
|
{% set profiler_token = '' %}
|
||||||
|
{% set profiler_link = '' %}
|
||||||
|
{% if trace.info.response_headers is defined %}
|
||||||
|
{% for header in trace.info.response_headers %}
|
||||||
|
{% if header matches '/^x-debug-token: .*$/i' %}
|
||||||
|
{% set profiler_token = (header.getValue | slice('x-debug-token: ' | length)) %}
|
||||||
|
{% endif %}
|
||||||
|
{% if header matches '/^x-debug-token-link: .*$/i' %}
|
||||||
|
{% set profiler_link = (header.getValue | slice('x-debug-token-link: ' | length)) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -66,6 +78,11 @@
|
|||||||
{{ profiler_dump(trace.options, maxDepth=1) }}
|
{{ profiler_dump(trace.options, maxDepth=1) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
|
{% if profiler_token and profiler_link %}
|
||||||
|
<th>
|
||||||
|
Profile
|
||||||
|
</th>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -85,6 +102,11 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ profiler_dump(trace.info, maxDepth=1) }}
|
{{ profiler_dump(trace.info, maxDepth=1) }}
|
||||||
</td>
|
</td>
|
||||||
|
{% if profiler_token and profiler_link %}
|
||||||
|
<td>
|
||||||
|
<span><a href="{{ profiler_link }}" target="_blank">{{ profiler_token }}</a></span>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Reference in New Issue
Block a user