Skip to content

Commit

Permalink
bug #20724 [WebProfilerBundle] Fix AJAX panel with fetch requests (On…
Browse files Browse the repository at this point in the history
…ekO)

This PR was squashed before being merged into the 3.2 branch (closes #20724).

Discussion
----------

[WebProfilerBundle] Fix AJAX panel with fetch requests

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20723
| License       | MIT
| Doc PR        | None

Commits
-------

5527ee3 [WebProfilerBundle] Fix AJAX panel with fetch requests
  • Loading branch information
fabpot committed Dec 13, 2016
2 parents 86e19d5 + 5527ee3 commit 25c0103
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,29 @@
var oldFetch = window.fetch;
window.fetch = function () {
var promise = oldFetch.apply(this, arguments);
if (!arguments[0].match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
var url = arguments[0];
var params = arguments[1];
var paramType = Object.prototype.toString.call(arguments[0]);
if (paramType === '[object Request]') {
url = arguments[0].url;
params = {
method: arguments[0].method,
credentials: arguments[0].credentials,
headers: arguments[0].headers,
mode: arguments[0].mode,
redirect: arguments[0].redirect
};
}
if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
var method = 'GET';
if (arguments[1] && arguments[1].method !== undefined) {
method = arguments[1].method;
if (params && params.method !== undefined) {
method = params.method;
}
var stackElement = {
loading: true,
error: false,
url: arguments[0],
url: url,
method: method,
type: 'fetch',
start: new Date()
Expand Down

0 comments on commit 25c0103

Please sign in to comment.