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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **adapter:** fix undefined reference to hasBrowserEnv ([#6572](https://github.com/axios/axios/issues/6572)) ([7004707](https://github.com/axios/axios/commit/7004707c4180b416341863bd86913fe4fc2f1df1))
9
+ * **core:** add the missed implementation of AxiosError#status property; ([#6573](https://github.com/axios/axios/issues/6573)) ([6700a8a](https://github.com/axios/axios/commit/6700a8adac06942205f6a7a21421ecb36c4e0852))
10
+ * **core:** fix `ReferenceError: navigator is not defined` for custom environments; ([#6567](https://github.com/axios/axios/issues/6567)) ([fed1a4b](https://github.com/axios/axios/commit/fed1a4b2d78ed4a588c84e09d32749ed01dc2794))
11
+ * **fetch:** fix credentials handling in Cloudflare workers ([#6533](https://github.com/axios/axios/issues/6533)) ([550d885](https://github.com/axios/axios/commit/550d885eb90fd156add7b93bbdc54d30d2f9a98d))
12
+
13
+ ### Contributors to this release
14
+
15
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+187/-83 (#6573 #6567 #6566 #6564 #6563 #6557 #6556 #6555 #6554 #6552 )")
16
+ - <img src="https://avatars.githubusercontent.com/u/2495809?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Antonin Bas](https://github.com/antoninbas "+6/-6 (#6572 )")
17
+ - <img src="https://avatars.githubusercontent.com/u/5406212?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Hans Otto Wirtz](https://github.com/hansottowirtz "+4/-1 (#6533 )")
18
+
3
19
  ## [1.7.4](https://github.com/axios/axios/compare/v1.7.3...v1.7.4) (2024-08-13)
4
20
 
5
21
 
package/README.md CHANGED
@@ -1,62 +1,11 @@
1
- <h3 align="center">
2
- Platinum sponsors
3
- <br>
4
- </h3>
5
1
 
6
- <div align="center">
7
- <a href="https://runalloy.com?utm_source=github&utm_medium=referral&utm_campaign=121423_axios">
8
- <picture>
9
- <source width="400px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/f6067247-7eba-4069-852a-ab1bb85b1780">
10
- <source width="400px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10">
11
- <img width="400px" src="https://github.com/axios/axios/assets/4814473/75c37f4d-36e6-44f5-a068-3edd77c00a10" />
12
- </picture>
13
- </a>
14
-
15
- <p align="center">Alloy is the integration development platform that makes it simple and <br>fast for SaaS companies to launch critical user-facing integrations.</p>
16
- <p align="center">
17
- <a href="https://runalloy.com/signup?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Sign up free</b></a> •
18
- <a href="https://docs.runalloy.com/docs?utm_source=github&utm_medium=referral&utm_campaign=11823_axios"><b>Documentation</b></a>
19
- </p>
20
- <br><br>
21
- </div>
22
-
23
- <h3 align="center">
24
- Gold sponsors
25
- <br><br>
26
- </h3>
27
-
28
- <table border="0">
29
- <td align="center">
30
- <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
31
- <picture>
32
- <source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/538d715a-13c7-4668-ae7d-37a4548423f4">
33
- <source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142">
34
- <img width="200px" src="https://github.com/axios/axios/assets/4814473/b6a9a7bc-9fb1-4b9b-909f-1b4bee1fd142" />
35
- </picture>
36
- </a>
37
- <p align="center">API-first authentication, authorization, and fraud prevention</p>
38
- <p align="center">
39
- <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> •
40
- <a href="https://stytch.com/docs?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=docs-link&utm_campaign=axios-http"><b>Documentation</b></a> • <a href="https://github.com/stytchauth/stytch-node?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=node-sdk&utm_campaign=axios-http"><b>Node.js Backend SDK</b></a>
41
- </p>
42
- </td>
43
- <td align="center">
44
- <a href="https://stytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=logo&utm_campaign=axios-http">
45
- <picture>
46
- <source width="200px" media="(prefers-color-scheme: dark)" srcset="https://github.com/axios/axios/assets/4814473/79f572f3-9d57-488d-80cc-58d674bb98d8">
47
- <source width="200px" media="(prefers-color-scheme: light)" srcset="https://github.com/axios/axios/assets/4814473/18b51893-c4b4-4557-b263-74c2b3de84ab">
48
- <img width="200px" src="https://github.com/axios/axios/assets/4814473/18b51893-c4b4-4557-b263-74c2b3de84ab" />
49
- </picture>
50
- </a>
51
- <p align="center">Drag-and-drop authentication, authorization, and identity management</p>
52
- <p align="center">
53
- <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> •
54
- <a href="https://docs.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Documentation</b></a> • <a href="https://www.descope.com/community?utm_source=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Community</b></a>
55
- </p>
56
- </td>
57
- </table>
58
-
2
+ <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://stytch.com/?utm_source&#x3D;oss-sponsorship&amp;utm_medium&#x3D;paid_sponsorship&amp;utm_content&#x3D;website-link&amp;utm_campaign&#x3D;axios-http" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="38px" media="(prefers-color-scheme: dark)" srcset="/assets/sponsors/stytch_white.png"> <img width="200px" height="38px" src="https://axios-http.com/assets/sponsors/stytch.png" alt="Stytch"/> </picture> </a> <p align="center" title="API-first authentication, authorization, and fraud prevention">API-first authentication, authorization, and fraud prevention</p> <p align="center"> <a href="https://stytch.com/?utm_source&#x3D;oss-sponsorship&amp;utm_medium&#x3D;paid_sponsorship&amp;utm_content&#x3D;website-link&amp;utm_campaign&#x3D;axios-http"><b>Website</b></a> | <a href="https://stytch.com/docs?utm_source&#x3D;oss-sponsorship&amp;utm_medium&#x3D;paid_sponsorship&amp;utm_content&#x3D;docs-link&amp;utm_campaign&#x3D;axios-http"><b>Documentation</b></a> | <a href="https://github.com/stytchauth/stytch-node?utm_source&#x3D;oss-sponsorship&amp;utm_medium&#x3D;paid_sponsorship&amp;utm_content&#x3D;node-sdk&amp;utm_campaign&#x3D;axios-http"><b>Node.js</b></a> </p>
3
+ </td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> </p>
4
+ </td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we&#x27;re Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we&#x27;re Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"><b>Documentation</b></a> | <a href="https://www.descope.com/community?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship"><b>Community</b></a> </p>
5
+ </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://route4me.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block"> <picture> <source width="200px" height="51px" media="(prefers-color-scheme: dark)" srcset="/assets/sponsors/route4me_white.png"> <img width="200px" height="51px" src="https://axios-http.com/assets/sponsors/route4me.png" alt="Route4Me"/> </picture> </a> <p align="center" title="Best Route Planning And Route Optimization Software">Best Route Planning And Route Optimization Software</p> <p align="center"> <a href="https://route4me.com/platform/route-optimization-software"><b>Explore</b></a> | <a href="https://route4me.com/platform/marketplace/pricing"><b>Free Trial</b></a> | <a href="https://route4me.com/contact"><b>Contact</b></a> </p>
6
+ </td></tr></table>
59
7
 
8
+ <!--<div>marker</div>-->
60
9
  <br><br>
61
10
  <div align="center">
62
11
  <a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" /></a><br>
package/dist/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 (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -1432,7 +1432,10 @@
1432
1432
  code && (this.code = code);
1433
1433
  config && (this.config = config);
1434
1434
  request && (this.request = request);
1435
- response && (this.response = response);
1435
+ if (response) {
1436
+ this.response = response;
1437
+ this.status = response.status ? response.status : null;
1438
+ }
1436
1439
  }
1437
1440
  utils$1.inherits(AxiosError, Error, {
1438
1441
  toJSON: function toJSON() {
@@ -1451,7 +1454,7 @@
1451
1454
  // Axios
1452
1455
  config: utils$1.toJSONObject(this.config),
1453
1456
  code: this.code,
1454
- status: this.response && this.response.status ? this.response.status : null
1457
+ status: this.status
1455
1458
  };
1456
1459
  }
1457
1460
  });
@@ -1860,6 +1863,7 @@
1860
1863
  };
1861
1864
 
1862
1865
  var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1866
+ var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
1863
1867
 
1864
1868
  /**
1865
1869
  * Determine if we're running in a standard browser environment
@@ -1878,9 +1882,7 @@
1878
1882
  *
1879
1883
  * @returns {boolean}
1880
1884
  */
1881
- var hasStandardBrowserEnv = function (product) {
1882
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0;
1883
- }(typeof navigator !== 'undefined' && navigator.product);
1885
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1884
1886
 
1885
1887
  /**
1886
1888
  * Determine if we're running in a standard browser webWorker environment
@@ -1903,6 +1905,7 @@
1903
1905
  hasBrowserEnv: hasBrowserEnv,
1904
1906
  hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1905
1907
  hasStandardBrowserEnv: hasStandardBrowserEnv,
1908
+ navigator: _navigator,
1906
1909
  origin: origin
1907
1910
  });
1908
1911
 
@@ -2643,7 +2646,7 @@
2643
2646
  // Standard browser envs have full support of the APIs needed to test
2644
2647
  // whether the request URL is of the same origin as current location.
2645
2648
  function standardBrowserEnv() {
2646
- var msie = /(msie|trident)/i.test(navigator.userAgent);
2649
+ var msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
2647
2650
  var urlParsingNode = document.createElement('a');
2648
2651
  var originURL;
2649
2652
 
@@ -3445,7 +3448,7 @@
3445
3448
  }();
3446
3449
  var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
3447
3450
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
3448
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
3451
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
3449
3452
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3450
3453
  while (1) switch (_context4.prev = _context4.next) {
3451
3454
  case 0:
@@ -3490,17 +3493,21 @@
3490
3493
  if (!utils$1.isString(withCredentials)) {
3491
3494
  withCredentials = withCredentials ? 'include' : 'omit';
3492
3495
  }
3496
+
3497
+ // Cloudflare Workers throws when credentials are defined
3498
+ // see https://github.com/cloudflare/workerd/issues/902
3499
+ isCredentialsSupported = "credentials" in Request.prototype;
3493
3500
  request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3494
3501
  signal: composedSignal,
3495
3502
  method: method.toUpperCase(),
3496
3503
  headers: headers.normalize().toJSON(),
3497
3504
  body: data,
3498
3505
  duplex: "half",
3499
- credentials: withCredentials
3506
+ credentials: isCredentialsSupported ? withCredentials : undefined
3500
3507
  }));
3501
- _context4.next = 19;
3508
+ _context4.next = 20;
3502
3509
  return fetch(request);
3503
- case 19:
3510
+ case 20:
3504
3511
  response = _context4.sent;
3505
3512
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3506
3513
  if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
@@ -3516,13 +3523,13 @@
3516
3523
  }, encodeText), options);
3517
3524
  }
3518
3525
  responseType = responseType || 'text';
3519
- _context4.next = 25;
3526
+ _context4.next = 26;
3520
3527
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3521
- case 25:
3528
+ case 26:
3522
3529
  responseData = _context4.sent;
3523
3530
  !isStreamResponse && onFinish();
3524
3531
  stopTimeout && stopTimeout();
3525
- _context4.next = 30;
3532
+ _context4.next = 31;
3526
3533
  return new Promise(function (resolve, reject) {
3527
3534
  settle(resolve, reject, {
3528
3535
  data: responseData,
@@ -3533,26 +3540,26 @@
3533
3540
  request: request
3534
3541
  });
3535
3542
  });
3536
- case 30:
3543
+ case 31:
3537
3544
  return _context4.abrupt("return", _context4.sent);
3538
- case 33:
3539
- _context4.prev = 33;
3545
+ case 34:
3546
+ _context4.prev = 34;
3540
3547
  _context4.t2 = _context4["catch"](4);
3541
3548
  onFinish();
3542
3549
  if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
3543
- _context4.next = 38;
3550
+ _context4.next = 39;
3544
3551
  break;
3545
3552
  }
3546
3553
  throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
3547
3554
  cause: _context4.t2.cause || _context4.t2
3548
3555
  });
3549
- case 38:
3550
- throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
3551
3556
  case 39:
3557
+ throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
3558
+ case 40:
3552
3559
  case "end":
3553
3560
  return _context4.stop();
3554
3561
  }
3555
- }, _callee4, null, [[4, 33]]);
3562
+ }, _callee4, null, [[4, 34]]);
3556
3563
  }));
3557
3564
  return function (_x5) {
3558
3565
  return _ref4.apply(this, arguments);
@@ -3676,7 +3683,7 @@
3676
3683
  });
3677
3684
  }
3678
3685
 
3679
- var VERSION = "1.7.4";
3686
+ var VERSION = "1.7.5";
3680
3687
 
3681
3688
  var validators$1 = {};
3682
3689