@whitesev/utils 1.5.4 → 1.5.6
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/dist/index.amd.js +11 -9
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +11 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +11 -9
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +11 -9
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +11 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Httpx.d.ts +1 -1
- package/dist/src/Utils.d.ts +3 -3
- package/package.json +1 -1
- package/src/Httpx.ts +18 -8
- package/src/Utils.ts +1 -0
- package/src/ajaxHooker/ajaxHooker.js +0 -1
- package/src/ajaxHooker/index.d.ts +4 -4
package/dist/index.system.js
CHANGED
|
@@ -460,7 +460,6 @@ System.register('Utils', [], (function (exports) {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
/// <reference path="./index.d.ts" />
|
|
464
463
|
// @name ajaxHooker
|
|
465
464
|
// @author cxxjackie
|
|
466
465
|
// @version 1.4.3
|
|
@@ -1509,13 +1508,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
1509
1508
|
},
|
|
1510
1509
|
/**
|
|
1511
1510
|
* 成功的回调
|
|
1512
|
-
* @param response
|
|
1511
|
+
* @param response 响应
|
|
1512
|
+
* @param details 请求的配置
|
|
1513
1513
|
*/
|
|
1514
|
-
successResponseCallBack(response) {
|
|
1514
|
+
successResponseCallBack(response, details) {
|
|
1515
1515
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1516
1516
|
let item = this.$config.configList[index];
|
|
1517
1517
|
if (typeof item.successFn === "function") {
|
|
1518
|
-
if (item.successFn(response) == null) {
|
|
1518
|
+
if (item.successFn(response, details) == null) {
|
|
1519
1519
|
return;
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
@@ -1524,7 +1524,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1524
1524
|
},
|
|
1525
1525
|
/**
|
|
1526
1526
|
* 失败的回调
|
|
1527
|
-
* @param
|
|
1527
|
+
* @param data 配置
|
|
1528
1528
|
*/
|
|
1529
1529
|
errorResponseCallBack(data) {
|
|
1530
1530
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
@@ -1787,6 +1787,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1787
1787
|
type: "onabort",
|
|
1788
1788
|
error: new TypeError("request canceled"),
|
|
1789
1789
|
response: null,
|
|
1790
|
+
details: details,
|
|
1790
1791
|
}) == null) {
|
|
1791
1792
|
return;
|
|
1792
1793
|
}
|
|
@@ -1818,6 +1819,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1818
1819
|
type: "onerror",
|
|
1819
1820
|
error: new TypeError("request error"),
|
|
1820
1821
|
response: response,
|
|
1822
|
+
details: details,
|
|
1821
1823
|
}) == null) {
|
|
1822
1824
|
return;
|
|
1823
1825
|
}
|
|
@@ -1846,6 +1848,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1846
1848
|
type: "ontimeout",
|
|
1847
1849
|
error: new TypeError("request timeout"),
|
|
1848
1850
|
response: (argumentsList || [null])[0],
|
|
1851
|
+
details: details,
|
|
1849
1852
|
}) == null) {
|
|
1850
1853
|
return;
|
|
1851
1854
|
}
|
|
@@ -1929,8 +1932,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
1929
1932
|
}
|
|
1930
1933
|
/* 状态码2xx都是成功的 */
|
|
1931
1934
|
if (Math.floor(Response.status / 100) === 2) {
|
|
1932
|
-
if (this.context.HttpxResponseHook.successResponseCallBack(Response) ==
|
|
1933
|
-
null) {
|
|
1935
|
+
if (this.context.HttpxResponseHook.successResponseCallBack(Response, details) == null) {
|
|
1934
1936
|
return;
|
|
1935
1937
|
}
|
|
1936
1938
|
resolve({
|
|
@@ -2051,7 +2053,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2051
2053
|
let responseText = "";
|
|
2052
2054
|
/** 响应xml文档 */
|
|
2053
2055
|
let responseXML = "";
|
|
2054
|
-
let arrayBuffer = await resp.arrayBuffer;
|
|
2056
|
+
let arrayBuffer = await resp.arrayBuffer();
|
|
2055
2057
|
let encoding = "utf-8";
|
|
2056
2058
|
if (resp.headers.has("Content-Type")) {
|
|
2057
2059
|
let charsetMatched = resp.headers
|
|
@@ -2062,7 +2064,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2062
2064
|
}
|
|
2063
2065
|
}
|
|
2064
2066
|
let textDecoder = new TextDecoder(encoding);
|
|
2065
|
-
responseText = textDecoder.decode(
|
|
2067
|
+
responseText = textDecoder.decode(arrayBuffer);
|
|
2066
2068
|
response = responseText;
|
|
2067
2069
|
if (details.responseType === "arraybuffer") {
|
|
2068
2070
|
response = arrayBuffer;
|