@whitesev/utils 1.9.0 → 1.9.2

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.
@@ -1794,6 +1794,14 @@ var Utils = (function () {
1794
1794
  fetch: details.fetch || this.context.#defaultDetails.fetch,
1795
1795
  /* 对象使用深拷贝 */
1796
1796
  fetchInit: utils.deepClone(this.context.#defaultDetails.fetchInit),
1797
+ allowInterceptConfig: {
1798
+ beforeRequest: this.context.#defaultDetails
1799
+ .allowInterceptConfig.beforeRequest,
1800
+ afterResponseSuccess: this.context.#defaultDetails
1801
+ .allowInterceptConfig.afterResponseSuccess,
1802
+ afterResponseError: this.context.#defaultDetails
1803
+ .allowInterceptConfig.afterResponseError,
1804
+ },
1797
1805
  user: details.user || this.context.#defaultDetails.user,
1798
1806
  password: details.password || this.context.#defaultDetails.password,
1799
1807
  onabort(...args) {
@@ -1818,6 +1826,26 @@ var Utils = (function () {
1818
1826
  that.context.HttpxCallBack.onLoad(details, resolve, reject, args);
1819
1827
  },
1820
1828
  };
1829
+ // 补全allowInterceptConfig参数
1830
+ if (typeof details.allowInterceptConfig === "boolean") {
1831
+ Object.keys(result.allowInterceptConfig).forEach((keyName) => {
1832
+ result.allowInterceptConfig[keyName] =
1833
+ details.allowInterceptConfig;
1834
+ });
1835
+ }
1836
+ else {
1837
+ if (typeof details.allowInterceptConfig === "object" &&
1838
+ details.allowInterceptConfig != null) {
1839
+ Object.keys(details.allowInterceptConfig).forEach((keyName) => {
1840
+ let value = details.allowInterceptConfig[keyName];
1841
+ if (keyName in
1842
+ result.allowInterceptConfig &&
1843
+ typeof value === "boolean") {
1844
+ result.allowInterceptConfig[keyName] = value;
1845
+ }
1846
+ });
1847
+ }
1848
+ }
1821
1849
  if (typeof this.context.GM_Api.xmlHttpRequest !== "function") {
1822
1850
  result.fetch = true;
1823
1851
  }