Skip to content

Commit 9e25563

Browse files
committed
Grab Request.url for breadcrumb in fetch instrumentation; fixes #924
1 parent d42697e commit 9e25563

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/raven.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,19 +1051,30 @@ Raven.prototype = {
10511051
// Make a copy of the arguments to prevent deoptimization
10521052
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
10531053
var args = new Array(arguments.length);
1054-
for(var i = 0; i < args.length; ++i) {
1054+
for (var i = 0; i < args.length; ++i) {
10551055
args[i] = arguments[i];
10561056
}
10571057

1058+
var fetchInput = args[0];
10581059
var method = 'GET';
1060+
var url;
1061+
1062+
if (typeof fetchInput === 'string') {
1063+
url = fetchInput;
1064+
} else {
1065+
url = fetchInput.url;
1066+
if (fetchInput.method) {
1067+
method = fetchInput.method;
1068+
}
1069+
}
10591070

10601071
if (args[1] && args[1].method) {
10611072
method = args[1].method;
10621073
}
10631074

10641075
var fetchData = {
10651076
method: method,
1066-
url: args[0],
1077+
url: url,
10671078
status_code: null
10681079
};
10691080

0 commit comments

Comments
 (0)