axios 1.7.4 → 1.7.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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

package/dist/esm/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
1
+ // Axios v1.7.5 Copyright (c) 2024 Matt Zabriskie and contributors
2
2
  function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -787,7 +787,10 @@ function AxiosError$1(message, code, config, request, response) {
787
787
  code && (this.code = code);
788
788
  config && (this.config = config);
789
789
  request && (this.request = request);
790
- response && (this.response = response);
790
+ if (response) {
791
+ this.response = response;
792
+ this.status = response.status ? response.status : null;
793
+ }
791
794
  }
792
795
 
793
796
  utils$1.inherits(AxiosError$1, Error, {
@@ -807,7 +810,7 @@ utils$1.inherits(AxiosError$1, Error, {
807
810
  // Axios
808
811
  config: utils$1.toJSONObject(this.config),
809
812
  code: this.code,
810
- status: this.response && this.response.status ? this.response.status : null
813
+ status: this.status
811
814
  };
812
815
  }
813
816
  });
@@ -1275,6 +1278,8 @@ const platform$1 = {
1275
1278
 
1276
1279
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1277
1280
 
1281
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
1282
+
1278
1283
  /**
1279
1284
  * Determine if we're running in a standard browser environment
1280
1285
  *
@@ -1292,10 +1297,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
1292
1297
  *
1293
1298
  * @returns {boolean}
1294
1299
  */
1295
- const hasStandardBrowserEnv = (
1296
- (product) => {
1297
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
1298
- })(typeof navigator !== 'undefined' && navigator.product);
1300
+ const hasStandardBrowserEnv = hasBrowserEnv &&
1301
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1299
1302
 
1300
1303
  /**
1301
1304
  * Determine if we're running in a standard browser webWorker environment
@@ -1322,6 +1325,7 @@ const utils = /*#__PURE__*/Object.freeze({
1322
1325
  hasBrowserEnv: hasBrowserEnv,
1323
1326
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1324
1327
  hasStandardBrowserEnv: hasStandardBrowserEnv,
1328
+ navigator: _navigator,
1325
1329
  origin: origin
1326
1330
  });
1327
1331
 
@@ -2151,7 +2155,7 @@ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
2151
2155
  // Standard browser envs have full support of the APIs needed to test
2152
2156
  // whether the request URL is of the same origin as current location.
2153
2157
  (function standardBrowserEnv() {
2154
- const msie = /(msie|trident)/i.test(navigator.userAgent);
2158
+ const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
2155
2159
  const urlParsingNode = document.createElement('a');
2156
2160
  let originURL;
2157
2161
 
@@ -2888,6 +2892,9 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2888
2892
  withCredentials = withCredentials ? 'include' : 'omit';
2889
2893
  }
2890
2894
 
2895
+ // Cloudflare Workers throws when credentials are defined
2896
+ // see https://github.com/cloudflare/workerd/issues/902
2897
+ const isCredentialsSupported = "credentials" in Request.prototype;
2891
2898
  request = new Request(url, {
2892
2899
  ...fetchOptions,
2893
2900
  signal: composedSignal,
@@ -2895,7 +2902,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2895
2902
  headers: headers.normalize().toJSON(),
2896
2903
  body: data,
2897
2904
  duplex: "half",
2898
- credentials: withCredentials
2905
+ credentials: isCredentialsSupported ? withCredentials : undefined
2899
2906
  });
2900
2907
 
2901
2908
  let response = await fetch(request);
@@ -3106,7 +3113,7 @@ function dispatchRequest(config) {
3106
3113
  });
3107
3114
  }
3108
3115
 
3109
- const VERSION$1 = "1.7.4";
3116
+ const VERSION$1 = "1.7.5";
3110
3117
 
3111
3118
  const validators$1 = {};
3112
3119