@cloudcare/browser-core 2.0.5 → 2.0.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.
|
@@ -13,8 +13,6 @@ var _tools = require("../helper/tools");
|
|
|
13
13
|
|
|
14
14
|
var _urlPolyfill = require("../helper/urlPolyfill");
|
|
15
15
|
|
|
16
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
17
|
-
|
|
18
16
|
var fetchObservable;
|
|
19
17
|
|
|
20
18
|
function initFetchObservable() {
|
|
@@ -52,8 +50,8 @@ function createFetchObservable() {
|
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
function beforeSend(observable, input, init) {
|
|
55
|
-
var method = init && init.method ||
|
|
56
|
-
var url = (0, _urlPolyfill.normalizeUrl)(
|
|
53
|
+
var method = init && init.method || input instanceof Request && input.method || 'GET';
|
|
54
|
+
var url = input instanceof Request ? input.url : (0, _urlPolyfill.normalizeUrl)(String(input));
|
|
57
55
|
var startClocks = (0, _tools.clocksNow)();
|
|
58
56
|
var context = {
|
|
59
57
|
state: 'start',
|
|
@@ -78,7 +76,8 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
78
76
|
context.error = response;
|
|
79
77
|
} else if ('status' in response) {
|
|
80
78
|
context.response = response;
|
|
81
|
-
context.responseType = response.type;
|
|
79
|
+
context.responseType = response instanceof Response && response.type || ''; // issue The Response type getter can only be used on instances of Response
|
|
80
|
+
|
|
82
81
|
context.status = response.status;
|
|
83
82
|
context.isAborted = false;
|
|
84
83
|
}
|
|
@@ -38,8 +38,8 @@ function createFetchObservable() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function beforeSend(observable, input, init) {
|
|
41
|
-
var method = init && init.method ||
|
|
42
|
-
var url =
|
|
41
|
+
var method = init && init.method || input instanceof Request && input.method || 'GET';
|
|
42
|
+
var url = input instanceof Request ? input.url : normalizeUrl(String(input));
|
|
43
43
|
var startClocks = clocksNow();
|
|
44
44
|
var context = {
|
|
45
45
|
state: 'start',
|
|
@@ -64,7 +64,8 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
64
64
|
context.error = response;
|
|
65
65
|
} else if ('status' in response) {
|
|
66
66
|
context.response = response;
|
|
67
|
-
context.responseType = response.type;
|
|
67
|
+
context.responseType = response instanceof Response && response.type || ''; // issue The Response type getter can only be used on instances of Response
|
|
68
|
+
|
|
68
69
|
context.status = response.status;
|
|
69
70
|
context.isAborted = false;
|
|
70
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"author": "dataflux",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "3b02c2cb5c52f6d19f132931e76f75f418f8971a"
|
|
24
24
|
}
|
|
@@ -47,10 +47,9 @@ function createFetchObservable() {
|
|
|
47
47
|
|
|
48
48
|
function beforeSend(observable, input, init) {
|
|
49
49
|
var method =
|
|
50
|
-
(init && init.method) ||
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var url = normalizeUrl((typeof input === 'object' && input.url) || input)
|
|
50
|
+
(init && init.method) || (input instanceof Request && input.method) || 'GET'
|
|
51
|
+
var url = input instanceof Request ? input.url : normalizeUrl(String(input))
|
|
52
|
+
|
|
54
53
|
var startClocks = clocksNow()
|
|
55
54
|
|
|
56
55
|
var context = {
|
|
@@ -80,7 +79,8 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
80
79
|
context.error = response
|
|
81
80
|
} else if ('status' in response) {
|
|
82
81
|
context.response = response
|
|
83
|
-
context.responseType =
|
|
82
|
+
context.responseType =
|
|
83
|
+
(response instanceof Response && response.type) || '' // issue The Response type getter can only be used on instances of Response
|
|
84
84
|
context.status = response.status
|
|
85
85
|
context.isAborted = false
|
|
86
86
|
}
|