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