Skip to content

Commit 5527ee3

Browse files
OnekOfabpot
authored andcommitted
[WebProfilerBundle] Fix AJAX panel with fetch requests
1 parent 5e77aac commit 5527ee3

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,29 @@
243243
var oldFetch = window.fetch;
244244
window.fetch = function () {
245245
var promise = oldFetch.apply(this, arguments);
246-
if (!arguments[0].match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
246+
var url = arguments[0];
247+
var params = arguments[1];
248+
var paramType = Object.prototype.toString.call(arguments[0]);
249+
if (paramType === '[object Request]') {
250+
url = arguments[0].url;
251+
params = {
252+
method: arguments[0].method,
253+
credentials: arguments[0].credentials,
254+
headers: arguments[0].headers,
255+
mode: arguments[0].mode,
256+
redirect: arguments[0].redirect
257+
};
258+
}
259+
if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
247260
var method = 'GET';
248-
if (arguments[1] && arguments[1].method !== undefined) {
249-
method = arguments[1].method;
261+
if (params && params.method !== undefined) {
262+
method = params.method;
250263
}
251264
252265
var stackElement = {
253266
loading: true,
254267
error: false,
255-
url: arguments[0],
268+
url: url,
256269
method: method,
257270
type: 'fetch',
258271
start: new Date()

0 commit comments

Comments
 (0)