@whitesev/utils 1.5.4 → 1.5.5
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 -8
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +11 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +11 -8
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +11 -8
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +11 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Httpx.d.ts +1 -1
- package/dist/src/Utils.d.ts +2 -3
- package/package.json +1 -1
- package/src/Httpx.ts +18 -8
package/dist/index.amd.js
CHANGED
|
@@ -1506,13 +1506,14 @@ define((function () { 'use strict';
|
|
|
1506
1506
|
},
|
|
1507
1507
|
/**
|
|
1508
1508
|
* 成功的回调
|
|
1509
|
-
* @param response
|
|
1509
|
+
* @param response 响应
|
|
1510
|
+
* @param details 请求的配置
|
|
1510
1511
|
*/
|
|
1511
|
-
successResponseCallBack(response) {
|
|
1512
|
+
successResponseCallBack(response, details) {
|
|
1512
1513
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
1513
1514
|
let item = this.$config.configList[index];
|
|
1514
1515
|
if (typeof item.successFn === "function") {
|
|
1515
|
-
if (item.successFn(response) == null) {
|
|
1516
|
+
if (item.successFn(response, details) == null) {
|
|
1516
1517
|
return;
|
|
1517
1518
|
}
|
|
1518
1519
|
}
|
|
@@ -1521,7 +1522,7 @@ define((function () { 'use strict';
|
|
|
1521
1522
|
},
|
|
1522
1523
|
/**
|
|
1523
1524
|
* 失败的回调
|
|
1524
|
-
* @param
|
|
1525
|
+
* @param data 配置
|
|
1525
1526
|
*/
|
|
1526
1527
|
errorResponseCallBack(data) {
|
|
1527
1528
|
for (let index = 0; index < this.$config.configList.length; index++) {
|
|
@@ -1784,6 +1785,7 @@ define((function () { 'use strict';
|
|
|
1784
1785
|
type: "onabort",
|
|
1785
1786
|
error: new TypeError("request canceled"),
|
|
1786
1787
|
response: null,
|
|
1788
|
+
details: details,
|
|
1787
1789
|
}) == null) {
|
|
1788
1790
|
return;
|
|
1789
1791
|
}
|
|
@@ -1815,6 +1817,7 @@ define((function () { 'use strict';
|
|
|
1815
1817
|
type: "onerror",
|
|
1816
1818
|
error: new TypeError("request error"),
|
|
1817
1819
|
response: response,
|
|
1820
|
+
details: details,
|
|
1818
1821
|
}) == null) {
|
|
1819
1822
|
return;
|
|
1820
1823
|
}
|
|
@@ -1843,6 +1846,7 @@ define((function () { 'use strict';
|
|
|
1843
1846
|
type: "ontimeout",
|
|
1844
1847
|
error: new TypeError("request timeout"),
|
|
1845
1848
|
response: (argumentsList || [null])[0],
|
|
1849
|
+
details: details,
|
|
1846
1850
|
}) == null) {
|
|
1847
1851
|
return;
|
|
1848
1852
|
}
|
|
@@ -1926,8 +1930,7 @@ define((function () { 'use strict';
|
|
|
1926
1930
|
}
|
|
1927
1931
|
/* 状态码2xx都是成功的 */
|
|
1928
1932
|
if (Math.floor(Response.status / 100) === 2) {
|
|
1929
|
-
if (this.context.HttpxResponseHook.successResponseCallBack(Response) ==
|
|
1930
|
-
null) {
|
|
1933
|
+
if (this.context.HttpxResponseHook.successResponseCallBack(Response, details) == null) {
|
|
1931
1934
|
return;
|
|
1932
1935
|
}
|
|
1933
1936
|
resolve({
|
|
@@ -2048,7 +2051,7 @@ define((function () { 'use strict';
|
|
|
2048
2051
|
let responseText = "";
|
|
2049
2052
|
/** 响应xml文档 */
|
|
2050
2053
|
let responseXML = "";
|
|
2051
|
-
let arrayBuffer = await resp.arrayBuffer;
|
|
2054
|
+
let arrayBuffer = await resp.arrayBuffer();
|
|
2052
2055
|
let encoding = "utf-8";
|
|
2053
2056
|
if (resp.headers.has("Content-Type")) {
|
|
2054
2057
|
let charsetMatched = resp.headers
|
|
@@ -2059,7 +2062,7 @@ define((function () { 'use strict';
|
|
|
2059
2062
|
}
|
|
2060
2063
|
}
|
|
2061
2064
|
let textDecoder = new TextDecoder(encoding);
|
|
2062
|
-
responseText = textDecoder.decode(
|
|
2065
|
+
responseText = textDecoder.decode(arrayBuffer);
|
|
2063
2066
|
response = responseText;
|
|
2064
2067
|
if (details.responseType === "arraybuffer") {
|
|
2065
2068
|
response = arrayBuffer;
|