@openreplay/tracker 5.0.5-beta.4 → 5.0.5-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/app/index.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/modules/axiosSpy.js +75 -72
- package/cjs/modules/network.js +3 -3
- package/lib/app/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/modules/axiosSpy.js +75 -72
- package/lib/modules/network.js +3 -3
- package/package.json +1 -1
package/cjs/app/index.js
CHANGED
|
@@ -33,7 +33,7 @@ class App {
|
|
|
33
33
|
this.stopCallbacks = [];
|
|
34
34
|
this.commitCallbacks = [];
|
|
35
35
|
this.activityState = ActivityState.NotActive;
|
|
36
|
-
this.version = '5.0.5-beta.
|
|
36
|
+
this.version = '5.0.5-beta.7'; // TODO: version compatability check inside each plugin.
|
|
37
37
|
this._usingOldFetchPlugin = false;
|
|
38
38
|
this.delay = 0;
|
|
39
39
|
this.projectKey = projectKey;
|
package/cjs/index.js
CHANGED
|
@@ -140,7 +140,7 @@ class API {
|
|
|
140
140
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
141
141
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
142
142
|
req.send(JSON.stringify({
|
|
143
|
-
trackerVersion: '5.0.5-beta.
|
|
143
|
+
trackerVersion: '5.0.5-beta.7',
|
|
144
144
|
projectKey: options.projectKey,
|
|
145
145
|
doNotTrack,
|
|
146
146
|
// TODO: add precise reason (an exact API missing)
|
package/cjs/modules/axiosSpy.js
CHANGED
|
@@ -1,73 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const messages_gen_js_1 = require("../app/messages.gen.js");
|
|
4
13
|
const utils_js_1 = require("../utils.js");
|
|
5
14
|
const exception_js_1 = require("./exception.js");
|
|
6
15
|
function default_1(app, instance, opts, sanitize, stringify) {
|
|
7
16
|
app.debug.log('Openreplay: attaching axios spy to instance', instance);
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
8
18
|
function captureResponseData(axiosResponseObj) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
app.debug.log('Openreplay: capturing axios response data', axiosResponseObj);
|
|
21
|
+
const { headers: reqHs, data: reqData, method, url } = axiosResponseObj.config;
|
|
22
|
+
const { data: rData, headers: rHs, status: globStatus, response } = axiosResponseObj;
|
|
23
|
+
const { data: resData, headers: resHs, status: resStatus } = response || {};
|
|
24
|
+
const ihOpt = opts.ignoreHeaders;
|
|
25
|
+
const isHIgnoring = Array.isArray(ihOpt) ? (name) => ihOpt.includes(name) : () => ihOpt;
|
|
26
|
+
function writeHeader(hsObj, header) {
|
|
27
|
+
if (!isHIgnoring(header[0])) {
|
|
28
|
+
hsObj[header[0]] = header[1];
|
|
29
|
+
}
|
|
18
30
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
let requestHs = {};
|
|
32
|
+
let responseHs = {};
|
|
33
|
+
if (reqHs.toJSON) {
|
|
34
|
+
requestHs = reqHs.toJSON();
|
|
35
|
+
}
|
|
36
|
+
else if (reqHs instanceof Headers) {
|
|
37
|
+
reqHs.forEach((v, n) => writeHeader(requestHs, [n, v]));
|
|
38
|
+
}
|
|
39
|
+
else if (Array.isArray(reqHs)) {
|
|
40
|
+
reqHs.forEach((h) => writeHeader(requestHs, h));
|
|
41
|
+
}
|
|
42
|
+
else if (typeof reqHs === 'object') {
|
|
43
|
+
Object.entries(reqHs).forEach((h) => writeHeader(requestHs, h));
|
|
44
|
+
}
|
|
45
|
+
const usedResHeader = resHs ? resHs : rHs;
|
|
46
|
+
if (usedResHeader.toJSON) {
|
|
47
|
+
responseHs = usedResHeader.toJSON();
|
|
48
|
+
}
|
|
49
|
+
else if (usedResHeader instanceof Headers) {
|
|
50
|
+
usedResHeader.forEach((v, n) => writeHeader(responseHs, [n, v]));
|
|
51
|
+
}
|
|
52
|
+
else if (Array.isArray(usedResHeader)) {
|
|
53
|
+
usedResHeader.forEach((h) => writeHeader(responseHs, h));
|
|
54
|
+
}
|
|
55
|
+
else if (typeof usedResHeader === 'object') {
|
|
56
|
+
Object.entries(usedResHeader).forEach(([n, v]) => {
|
|
57
|
+
if (!isHIgnoring(n))
|
|
58
|
+
responseHs[n] = v;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const reqResInfo = sanitize({
|
|
62
|
+
url,
|
|
63
|
+
method: method || '',
|
|
64
|
+
status: globStatus || resStatus || 0,
|
|
65
|
+
request: {
|
|
66
|
+
headers: requestHs,
|
|
67
|
+
body: reqData,
|
|
68
|
+
},
|
|
69
|
+
response: {
|
|
70
|
+
headers: responseHs,
|
|
71
|
+
body: resData || rData,
|
|
72
|
+
},
|
|
48
73
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
response: {
|
|
59
|
-
headers: responseHs,
|
|
60
|
-
body: resData || rData,
|
|
61
|
-
},
|
|
74
|
+
if (!reqResInfo) {
|
|
75
|
+
app.debug.log('Openreplay: empty request/response info, skipping');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const requestStart = axiosResponseObj.config.__openreplay_timing;
|
|
79
|
+
const duration = performance.now() - requestStart;
|
|
80
|
+
console.log(reqResInfo, 'finally');
|
|
81
|
+
app.send((0, messages_gen_js_1.NetworkRequest)('xhr', String(method), String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), reqResInfo.status, requestStart + (0, utils_js_1.getTimeOrigin)(), duration));
|
|
62
82
|
});
|
|
63
|
-
if (!reqResInfo) {
|
|
64
|
-
app.debug.log('Openreplay: empty request/response info, skipping');
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const requestStart = axiosResponseObj.config.__openreplay_timing;
|
|
68
|
-
const duration = performance.now() - requestStart;
|
|
69
|
-
console.log(reqResInfo, 'finally');
|
|
70
|
-
app.send((0, messages_gen_js_1.NetworkRequest)('xhr', String(method), String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), reqResInfo.status, requestStart + (0, utils_js_1.getTimeOrigin)(), duration));
|
|
71
83
|
}
|
|
72
84
|
function getStartTime(config) {
|
|
73
85
|
app.debug.log('Openreplay: capturing API request', config);
|
|
@@ -86,13 +98,13 @@ function default_1(app, instance, opts, sanitize, stringify) {
|
|
|
86
98
|
function captureNetworkRequest(response) {
|
|
87
99
|
if (opts.failuresOnly)
|
|
88
100
|
return response;
|
|
89
|
-
captureResponseData(response);
|
|
101
|
+
void captureResponseData(response);
|
|
90
102
|
return response;
|
|
91
103
|
}
|
|
92
104
|
function captureNetworkError(error) {
|
|
93
105
|
app.debug.log('Openreplay: capturing API request error', error);
|
|
94
106
|
if (isAxiosError(error)) {
|
|
95
|
-
captureResponseData(error.response);
|
|
107
|
+
void captureResponseData(error.response);
|
|
96
108
|
}
|
|
97
109
|
else if (error instanceof Error) {
|
|
98
110
|
app.send((0, exception_js_1.getExceptionMessage)(error, []));
|
|
@@ -102,17 +114,8 @@ function default_1(app, instance, opts, sanitize, stringify) {
|
|
|
102
114
|
function logRequestError(ev) {
|
|
103
115
|
app.debug.log('Openreplay: failed API request, skipping', ev);
|
|
104
116
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
const resInt = instance.interceptors.response.use(captureNetworkRequest, captureNetworkError, {
|
|
109
|
-
synchronous: true,
|
|
110
|
-
});
|
|
111
|
-
app.attachStopCallback(() => {
|
|
112
|
-
var _a, _b, _c, _d;
|
|
113
|
-
(_b = (_a = instance.interceptors.request).eject) === null || _b === void 0 ? void 0 : _b.call(_a, reqInt);
|
|
114
|
-
(_d = (_c = instance.interceptors.response).eject) === null || _d === void 0 ? void 0 : _d.call(_c, resInt);
|
|
115
|
-
});
|
|
117
|
+
instance.interceptors.request.use(getStartTime, logRequestError);
|
|
118
|
+
instance.interceptors.response.use(captureNetworkRequest, captureNetworkError);
|
|
116
119
|
}
|
|
117
120
|
exports.default = default_1;
|
|
118
121
|
function isAxiosError(payload) {
|
package/cjs/modules/network.js
CHANGED
|
@@ -165,7 +165,9 @@ function default_1(app, opts = {}) {
|
|
|
165
165
|
});
|
|
166
166
|
xhr.addEventListener('load', app.safe((e) => {
|
|
167
167
|
const { headers: reqHs, body: reqBody } = getXHRRequestDataObject(xhr);
|
|
168
|
-
app.debug.log('Openreplay: XHR load
|
|
168
|
+
app.debug.log('Openreplay: XHR load', xhr, xhr.getAllResponseHeaders(), getXHRRequestDataObject(xhr));
|
|
169
|
+
if (!xhr.getAllResponseHeaders())
|
|
170
|
+
app.debug.warn('Openreplay: XHR no response headers returned');
|
|
169
171
|
const duration = startTime > 0 ? e.timeStamp - startTime : 0;
|
|
170
172
|
const hString = ignoreHeaders ? '' : xhr.getAllResponseHeaders(); // might be null (though only if no response received though)
|
|
171
173
|
const resHs = hString
|
|
@@ -202,12 +204,10 @@ function default_1(app, opts = {}) {
|
|
|
202
204
|
XMLHttpRequest.prototype.send = function (body) {
|
|
203
205
|
const rdo = getXHRRequestDataObject(this);
|
|
204
206
|
rdo.body = body;
|
|
205
|
-
app.debug.log('Openreplay: ', 'XHR send', rdo, 'XHR Object', this);
|
|
206
207
|
return nativeSend.apply(this, arguments);
|
|
207
208
|
};
|
|
208
209
|
const nativeSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
|
|
209
210
|
XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
|
|
210
|
-
app.debug.log('Openreplay: ', name, value, isHIgnored(name), getXHRRequestDataObject(this));
|
|
211
211
|
if (!isHIgnored(name)) {
|
|
212
212
|
const rdo = getXHRRequestDataObject(this);
|
|
213
213
|
rdo.headers[name] = value;
|
package/lib/app/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export default class App {
|
|
|
30
30
|
this.stopCallbacks = [];
|
|
31
31
|
this.commitCallbacks = [];
|
|
32
32
|
this.activityState = ActivityState.NotActive;
|
|
33
|
-
this.version = '5.0.5-beta.
|
|
33
|
+
this.version = '5.0.5-beta.7'; // TODO: version compatability check inside each plugin.
|
|
34
34
|
this._usingOldFetchPlugin = false;
|
|
35
35
|
this.delay = 0;
|
|
36
36
|
this.projectKey = projectKey;
|
package/lib/index.js
CHANGED
|
@@ -135,7 +135,7 @@ export default class API {
|
|
|
135
135
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
136
136
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
137
137
|
req.send(JSON.stringify({
|
|
138
|
-
trackerVersion: '5.0.5-beta.
|
|
138
|
+
trackerVersion: '5.0.5-beta.7',
|
|
139
139
|
projectKey: options.projectKey,
|
|
140
140
|
doNotTrack,
|
|
141
141
|
// TODO: add precise reason (an exact API missing)
|
package/lib/modules/axiosSpy.js
CHANGED
|
@@ -1,71 +1,83 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { NetworkRequest } from '../app/messages.gen.js';
|
|
2
11
|
import { getTimeOrigin } from '../utils.js';
|
|
3
12
|
import { getExceptionMessage } from './exception.js';
|
|
4
13
|
export default function (app, instance, opts, sanitize, stringify) {
|
|
5
14
|
app.debug.log('Openreplay: attaching axios spy to instance', instance);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
6
16
|
function captureResponseData(axiosResponseObj) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
app.debug.log('Openreplay: capturing axios response data', axiosResponseObj);
|
|
19
|
+
const { headers: reqHs, data: reqData, method, url } = axiosResponseObj.config;
|
|
20
|
+
const { data: rData, headers: rHs, status: globStatus, response } = axiosResponseObj;
|
|
21
|
+
const { data: resData, headers: resHs, status: resStatus } = response || {};
|
|
22
|
+
const ihOpt = opts.ignoreHeaders;
|
|
23
|
+
const isHIgnoring = Array.isArray(ihOpt) ? (name) => ihOpt.includes(name) : () => ihOpt;
|
|
24
|
+
function writeHeader(hsObj, header) {
|
|
25
|
+
if (!isHIgnoring(header[0])) {
|
|
26
|
+
hsObj[header[0]] = header[1];
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
let requestHs = {};
|
|
30
|
+
let responseHs = {};
|
|
31
|
+
if (reqHs.toJSON) {
|
|
32
|
+
requestHs = reqHs.toJSON();
|
|
33
|
+
}
|
|
34
|
+
else if (reqHs instanceof Headers) {
|
|
35
|
+
reqHs.forEach((v, n) => writeHeader(requestHs, [n, v]));
|
|
36
|
+
}
|
|
37
|
+
else if (Array.isArray(reqHs)) {
|
|
38
|
+
reqHs.forEach((h) => writeHeader(requestHs, h));
|
|
39
|
+
}
|
|
40
|
+
else if (typeof reqHs === 'object') {
|
|
41
|
+
Object.entries(reqHs).forEach((h) => writeHeader(requestHs, h));
|
|
42
|
+
}
|
|
43
|
+
const usedResHeader = resHs ? resHs : rHs;
|
|
44
|
+
if (usedResHeader.toJSON) {
|
|
45
|
+
responseHs = usedResHeader.toJSON();
|
|
46
|
+
}
|
|
47
|
+
else if (usedResHeader instanceof Headers) {
|
|
48
|
+
usedResHeader.forEach((v, n) => writeHeader(responseHs, [n, v]));
|
|
49
|
+
}
|
|
50
|
+
else if (Array.isArray(usedResHeader)) {
|
|
51
|
+
usedResHeader.forEach((h) => writeHeader(responseHs, h));
|
|
52
|
+
}
|
|
53
|
+
else if (typeof usedResHeader === 'object') {
|
|
54
|
+
Object.entries(usedResHeader).forEach(([n, v]) => {
|
|
55
|
+
if (!isHIgnoring(n))
|
|
56
|
+
responseHs[n] = v;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const reqResInfo = sanitize({
|
|
60
|
+
url,
|
|
61
|
+
method: method || '',
|
|
62
|
+
status: globStatus || resStatus || 0,
|
|
63
|
+
request: {
|
|
64
|
+
headers: requestHs,
|
|
65
|
+
body: reqData,
|
|
66
|
+
},
|
|
67
|
+
response: {
|
|
68
|
+
headers: responseHs,
|
|
69
|
+
body: resData || rData,
|
|
70
|
+
},
|
|
46
71
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
response: {
|
|
57
|
-
headers: responseHs,
|
|
58
|
-
body: resData || rData,
|
|
59
|
-
},
|
|
72
|
+
if (!reqResInfo) {
|
|
73
|
+
app.debug.log('Openreplay: empty request/response info, skipping');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const requestStart = axiosResponseObj.config.__openreplay_timing;
|
|
77
|
+
const duration = performance.now() - requestStart;
|
|
78
|
+
console.log(reqResInfo, 'finally');
|
|
79
|
+
app.send(NetworkRequest('xhr', String(method), String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), reqResInfo.status, requestStart + getTimeOrigin(), duration));
|
|
60
80
|
});
|
|
61
|
-
if (!reqResInfo) {
|
|
62
|
-
app.debug.log('Openreplay: empty request/response info, skipping');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const requestStart = axiosResponseObj.config.__openreplay_timing;
|
|
66
|
-
const duration = performance.now() - requestStart;
|
|
67
|
-
console.log(reqResInfo, 'finally');
|
|
68
|
-
app.send(NetworkRequest('xhr', String(method), String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), reqResInfo.status, requestStart + getTimeOrigin(), duration));
|
|
69
81
|
}
|
|
70
82
|
function getStartTime(config) {
|
|
71
83
|
app.debug.log('Openreplay: capturing API request', config);
|
|
@@ -84,13 +96,13 @@ export default function (app, instance, opts, sanitize, stringify) {
|
|
|
84
96
|
function captureNetworkRequest(response) {
|
|
85
97
|
if (opts.failuresOnly)
|
|
86
98
|
return response;
|
|
87
|
-
captureResponseData(response);
|
|
99
|
+
void captureResponseData(response);
|
|
88
100
|
return response;
|
|
89
101
|
}
|
|
90
102
|
function captureNetworkError(error) {
|
|
91
103
|
app.debug.log('Openreplay: capturing API request error', error);
|
|
92
104
|
if (isAxiosError(error)) {
|
|
93
|
-
captureResponseData(error.response);
|
|
105
|
+
void captureResponseData(error.response);
|
|
94
106
|
}
|
|
95
107
|
else if (error instanceof Error) {
|
|
96
108
|
app.send(getExceptionMessage(error, []));
|
|
@@ -100,17 +112,8 @@ export default function (app, instance, opts, sanitize, stringify) {
|
|
|
100
112
|
function logRequestError(ev) {
|
|
101
113
|
app.debug.log('Openreplay: failed API request, skipping', ev);
|
|
102
114
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
const resInt = instance.interceptors.response.use(captureNetworkRequest, captureNetworkError, {
|
|
107
|
-
synchronous: true,
|
|
108
|
-
});
|
|
109
|
-
app.attachStopCallback(() => {
|
|
110
|
-
var _a, _b, _c, _d;
|
|
111
|
-
(_b = (_a = instance.interceptors.request).eject) === null || _b === void 0 ? void 0 : _b.call(_a, reqInt);
|
|
112
|
-
(_d = (_c = instance.interceptors.response).eject) === null || _d === void 0 ? void 0 : _d.call(_c, resInt);
|
|
113
|
-
});
|
|
115
|
+
instance.interceptors.request.use(getStartTime, logRequestError);
|
|
116
|
+
instance.interceptors.response.use(captureNetworkRequest, captureNetworkError);
|
|
114
117
|
}
|
|
115
118
|
function isAxiosError(payload) {
|
|
116
119
|
return isObject(payload) && payload.isAxiosError === true;
|
package/lib/modules/network.js
CHANGED
|
@@ -163,7 +163,9 @@ export default function (app, opts = {}) {
|
|
|
163
163
|
});
|
|
164
164
|
xhr.addEventListener('load', app.safe((e) => {
|
|
165
165
|
const { headers: reqHs, body: reqBody } = getXHRRequestDataObject(xhr);
|
|
166
|
-
app.debug.log('Openreplay: XHR load
|
|
166
|
+
app.debug.log('Openreplay: XHR load', xhr, xhr.getAllResponseHeaders(), getXHRRequestDataObject(xhr));
|
|
167
|
+
if (!xhr.getAllResponseHeaders())
|
|
168
|
+
app.debug.warn('Openreplay: XHR no response headers returned');
|
|
167
169
|
const duration = startTime > 0 ? e.timeStamp - startTime : 0;
|
|
168
170
|
const hString = ignoreHeaders ? '' : xhr.getAllResponseHeaders(); // might be null (though only if no response received though)
|
|
169
171
|
const resHs = hString
|
|
@@ -200,12 +202,10 @@ export default function (app, opts = {}) {
|
|
|
200
202
|
XMLHttpRequest.prototype.send = function (body) {
|
|
201
203
|
const rdo = getXHRRequestDataObject(this);
|
|
202
204
|
rdo.body = body;
|
|
203
|
-
app.debug.log('Openreplay: ', 'XHR send', rdo, 'XHR Object', this);
|
|
204
205
|
return nativeSend.apply(this, arguments);
|
|
205
206
|
};
|
|
206
207
|
const nativeSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
|
|
207
208
|
XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
|
|
208
|
-
app.debug.log('Openreplay: ', name, value, isHIgnored(name), getXHRRequestDataObject(this));
|
|
209
209
|
if (!isHIgnored(name)) {
|
|
210
210
|
const rdo = getXHRRequestDataObject(this);
|
|
211
211
|
rdo.headers[name] = value;
|