@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.
@@ -1509,13 +1509,14 @@ System.register('Utils', [], (function (exports) {
1509
1509
  },
1510
1510
  /**
1511
1511
  * 成功的回调
1512
- * @param response
1512
+ * @param response 响应
1513
+ * @param details 请求的配置
1513
1514
  */
1514
- successResponseCallBack(response) {
1515
+ successResponseCallBack(response, details) {
1515
1516
  for (let index = 0; index < this.$config.configList.length; index++) {
1516
1517
  let item = this.$config.configList[index];
1517
1518
  if (typeof item.successFn === "function") {
1518
- if (item.successFn(response) == null) {
1519
+ if (item.successFn(response, details) == null) {
1519
1520
  return;
1520
1521
  }
1521
1522
  }
@@ -1524,7 +1525,7 @@ System.register('Utils', [], (function (exports) {
1524
1525
  },
1525
1526
  /**
1526
1527
  * 失败的回调
1527
- * @param response
1528
+ * @param data 配置
1528
1529
  */
1529
1530
  errorResponseCallBack(data) {
1530
1531
  for (let index = 0; index < this.$config.configList.length; index++) {
@@ -1787,6 +1788,7 @@ System.register('Utils', [], (function (exports) {
1787
1788
  type: "onabort",
1788
1789
  error: new TypeError("request canceled"),
1789
1790
  response: null,
1791
+ details: details,
1790
1792
  }) == null) {
1791
1793
  return;
1792
1794
  }
@@ -1818,6 +1820,7 @@ System.register('Utils', [], (function (exports) {
1818
1820
  type: "onerror",
1819
1821
  error: new TypeError("request error"),
1820
1822
  response: response,
1823
+ details: details,
1821
1824
  }) == null) {
1822
1825
  return;
1823
1826
  }
@@ -1846,6 +1849,7 @@ System.register('Utils', [], (function (exports) {
1846
1849
  type: "ontimeout",
1847
1850
  error: new TypeError("request timeout"),
1848
1851
  response: (argumentsList || [null])[0],
1852
+ details: details,
1849
1853
  }) == null) {
1850
1854
  return;
1851
1855
  }
@@ -1929,8 +1933,7 @@ System.register('Utils', [], (function (exports) {
1929
1933
  }
1930
1934
  /* 状态码2xx都是成功的 */
1931
1935
  if (Math.floor(Response.status / 100) === 2) {
1932
- if (this.context.HttpxResponseHook.successResponseCallBack(Response) ==
1933
- null) {
1936
+ if (this.context.HttpxResponseHook.successResponseCallBack(Response, details) == null) {
1934
1937
  return;
1935
1938
  }
1936
1939
  resolve({
@@ -2051,7 +2054,7 @@ System.register('Utils', [], (function (exports) {
2051
2054
  let responseText = "";
2052
2055
  /** 响应xml文档 */
2053
2056
  let responseXML = "";
2054
- let arrayBuffer = await resp.arrayBuffer;
2057
+ let arrayBuffer = await resp.arrayBuffer();
2055
2058
  let encoding = "utf-8";
2056
2059
  if (resp.headers.has("Content-Type")) {
2057
2060
  let charsetMatched = resp.headers
@@ -2062,7 +2065,7 @@ System.register('Utils', [], (function (exports) {
2062
2065
  }
2063
2066
  }
2064
2067
  let textDecoder = new TextDecoder(encoding);
2065
- responseText = textDecoder.decode(await resp.arrayBuffer());
2068
+ responseText = textDecoder.decode(arrayBuffer);
2066
2069
  response = responseText;
2067
2070
  if (details.responseType === "arraybuffer") {
2068
2071
  response = arrayBuffer;