@openreplay/tracker 5.0.5-beta.7 → 5.0.5-beta.9
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/network.js +27 -10
- package/lib/app/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/modules/network.js +27 -10
- 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.9'; // 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.9',
|
|
144
144
|
projectKey: options.projectKey,
|
|
145
145
|
doNotTrack,
|
|
146
146
|
// TODO: add precise reason (an exact API missing)
|
package/cjs/modules/network.js
CHANGED
|
@@ -165,18 +165,29 @@ 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', xhr, xhr.getAllResponseHeaders(), getXHRRequestDataObject(xhr));
|
|
169
168
|
if (!xhr.getAllResponseHeaders())
|
|
170
169
|
app.debug.warn('Openreplay: XHR no response headers returned');
|
|
171
170
|
const duration = startTime > 0 ? e.timeStamp - startTime : 0;
|
|
172
|
-
const hString =
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
const hString = xhr.getAllResponseHeaders(); // might be null (though only if no response received though)
|
|
172
|
+
const headersArr = hString.trim().split(/[\r\n]+/);
|
|
173
|
+
const headerMap = {};
|
|
174
|
+
headersArr.forEach(function (line) {
|
|
175
|
+
const parts = line.split(': ');
|
|
176
|
+
const header = parts.shift();
|
|
177
|
+
if (!isHIgnored(header)) {
|
|
178
|
+
headerMap[header] = parts.join(': ');
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
// const resHs = hString
|
|
182
|
+
// ? hString
|
|
183
|
+
// .split('\r\n')
|
|
184
|
+
// .map((h) => h.split(':'))
|
|
185
|
+
// .filter((entry) => !isHIgnored(entry[0]))
|
|
186
|
+
// .reduce(
|
|
187
|
+
// (hds, [name, value]) => ({ ...hds, [name]: value }),
|
|
188
|
+
// {} as Record<string, string>,
|
|
189
|
+
// )
|
|
190
|
+
// : {}
|
|
180
191
|
const method = strMethod(initMethod);
|
|
181
192
|
const reqResInfo = sanitize({
|
|
182
193
|
url: String(url),
|
|
@@ -187,13 +198,19 @@ function default_1(app, opts = {}) {
|
|
|
187
198
|
body: reqBody,
|
|
188
199
|
},
|
|
189
200
|
response: {
|
|
190
|
-
headers:
|
|
201
|
+
headers: headerMap,
|
|
191
202
|
body: xhr.response,
|
|
192
203
|
},
|
|
193
204
|
});
|
|
194
205
|
if (!reqResInfo) {
|
|
195
206
|
return;
|
|
196
207
|
}
|
|
208
|
+
app.debug.log('Openreplay: XHR load', reqResInfo.url, {
|
|
209
|
+
instance: xhr,
|
|
210
|
+
headers: xhr.getAllResponseHeaders(),
|
|
211
|
+
requestData: getXHRRequestDataObject(xhr),
|
|
212
|
+
result: (0, messages_gen_js_1.NetworkRequest)('xhr', method, String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), xhr.status, startTime + (0, utils_js_1.getTimeOrigin)(), duration),
|
|
213
|
+
}, headerMap);
|
|
197
214
|
app.send((0, messages_gen_js_1.NetworkRequest)('xhr', method, String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), xhr.status, startTime + (0, utils_js_1.getTimeOrigin)(), duration));
|
|
198
215
|
}));
|
|
199
216
|
//TODO: handle error (though it has no Error API nor any useful information)
|
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.9'; // 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.9',
|
|
139
139
|
projectKey: options.projectKey,
|
|
140
140
|
doNotTrack,
|
|
141
141
|
// TODO: add precise reason (an exact API missing)
|
package/lib/modules/network.js
CHANGED
|
@@ -163,18 +163,29 @@ 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', xhr, xhr.getAllResponseHeaders(), getXHRRequestDataObject(xhr));
|
|
167
166
|
if (!xhr.getAllResponseHeaders())
|
|
168
167
|
app.debug.warn('Openreplay: XHR no response headers returned');
|
|
169
168
|
const duration = startTime > 0 ? e.timeStamp - startTime : 0;
|
|
170
|
-
const hString =
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
const hString = xhr.getAllResponseHeaders(); // might be null (though only if no response received though)
|
|
170
|
+
const headersArr = hString.trim().split(/[\r\n]+/);
|
|
171
|
+
const headerMap = {};
|
|
172
|
+
headersArr.forEach(function (line) {
|
|
173
|
+
const parts = line.split(': ');
|
|
174
|
+
const header = parts.shift();
|
|
175
|
+
if (!isHIgnored(header)) {
|
|
176
|
+
headerMap[header] = parts.join(': ');
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
// const resHs = hString
|
|
180
|
+
// ? hString
|
|
181
|
+
// .split('\r\n')
|
|
182
|
+
// .map((h) => h.split(':'))
|
|
183
|
+
// .filter((entry) => !isHIgnored(entry[0]))
|
|
184
|
+
// .reduce(
|
|
185
|
+
// (hds, [name, value]) => ({ ...hds, [name]: value }),
|
|
186
|
+
// {} as Record<string, string>,
|
|
187
|
+
// )
|
|
188
|
+
// : {}
|
|
178
189
|
const method = strMethod(initMethod);
|
|
179
190
|
const reqResInfo = sanitize({
|
|
180
191
|
url: String(url),
|
|
@@ -185,13 +196,19 @@ export default function (app, opts = {}) {
|
|
|
185
196
|
body: reqBody,
|
|
186
197
|
},
|
|
187
198
|
response: {
|
|
188
|
-
headers:
|
|
199
|
+
headers: headerMap,
|
|
189
200
|
body: xhr.response,
|
|
190
201
|
},
|
|
191
202
|
});
|
|
192
203
|
if (!reqResInfo) {
|
|
193
204
|
return;
|
|
194
205
|
}
|
|
206
|
+
app.debug.log('Openreplay: XHR load', reqResInfo.url, {
|
|
207
|
+
instance: xhr,
|
|
208
|
+
headers: xhr.getAllResponseHeaders(),
|
|
209
|
+
requestData: getXHRRequestDataObject(xhr),
|
|
210
|
+
result: NetworkRequest('xhr', method, String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), xhr.status, startTime + getTimeOrigin(), duration),
|
|
211
|
+
}, headerMap);
|
|
195
212
|
app.send(NetworkRequest('xhr', method, String(reqResInfo.url), stringify(reqResInfo.request), stringify(reqResInfo.response), xhr.status, startTime + getTimeOrigin(), duration));
|
|
196
213
|
}));
|
|
197
214
|
//TODO: handle error (though it has no Error API nor any useful information)
|