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.

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