axios 1.7.4 → 1.7.6

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,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **fetch:** fix content length calculation for FormData payload; ([#6524](https://github.com/axios/axios/issues/6524)) ([085f568](https://github.com/axios/axios/commit/085f56861a83e9ac02c140ad9d68dac540dfeeaa))
9
+ * **fetch:** optimize signals composing logic; ([#6582](https://github.com/axios/axios/issues/6582)) ([df9889b](https://github.com/axios/axios/commit/df9889b83c2cc37e9e6189675a73ab70c60f031f))
10
+
11
+ ### Contributors to this release
12
+
13
+ - <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 "+98/-46 (#6582 )")
14
+ - <img src="https://avatars.githubusercontent.com/u/3534453?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Jacques Germishuys](https://github.com/jacquesg "+5/-1 (#6524 )")
15
+ - <img src="https://avatars.githubusercontent.com/u/53894505?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [kuroino721](https://github.com/kuroino721 "+3/-1 (#6575 )")
16
+
17
+ ## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **adapter:** fix undefined reference to hasBrowserEnv ([#6572](https://github.com/axios/axios/issues/6572)) ([7004707](https://github.com/axios/axios/commit/7004707c4180b416341863bd86913fe4fc2f1df1))
23
+ * **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))
24
+ * **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))
25
+ * **fetch:** fix credentials handling in Cloudflare workers ([#6533](https://github.com/axios/axios/issues/6533)) ([550d885](https://github.com/axios/axios/commit/550d885eb90fd156add7b93bbdc54d30d2f9a98d))
26
+
27
+ ### Contributors to this release
28
+
29
+ - <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 )")
30
+ - <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 )")
31
+ - <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 )")
32
+
3
33
  ## [1.7.4](https://github.com/axios/axios/compare/v1.7.3...v1.7.4) (2024-08-13)
4
34
 
5
35
 
package/README.md CHANGED
@@ -1,62 +1,12 @@
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://opencollective.com/buy-instagram-followers-buzzoid?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/buy-instagram-followers-buzzoid.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&#x27;s #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> </p>
3
+ </td><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>
4
+ </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>
5
+ </td></tr><tr width="33.333333333333336%"><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>
6
+ </td><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>
7
+ </td></tr></table>
59
8
 
9
+ <!--<div>marker</div>-->
60
10
  <br><br>
61
11
  <div align="center">
62
12
  <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.6 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
 
@@ -3090,38 +3093,42 @@
3090
3093
  };
3091
3094
 
3092
3095
  var composeSignals = function composeSignals(signals, timeout) {
3093
- var controller = new AbortController();
3094
- var aborted;
3095
- var onabort = function onabort(cancel) {
3096
- if (!aborted) {
3097
- aborted = true;
3098
- unsubscribe();
3099
- var err = cancel instanceof Error ? cancel : this.reason;
3100
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3101
- }
3102
- };
3103
- var timer = timeout && setTimeout(function () {
3104
- onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
3105
- }, timeout);
3106
- var unsubscribe = function unsubscribe() {
3107
- if (signals) {
3108
- timer && clearTimeout(timer);
3096
+ var _signals = signals = signals ? signals.filter(Boolean) : [],
3097
+ length = _signals.length;
3098
+ if (timeout || length) {
3099
+ var controller = new AbortController();
3100
+ var aborted;
3101
+ var onabort = function onabort(reason) {
3102
+ if (!aborted) {
3103
+ aborted = true;
3104
+ unsubscribe();
3105
+ var err = reason instanceof Error ? reason : this.reason;
3106
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3107
+ }
3108
+ };
3109
+ var timer = timeout && setTimeout(function () {
3109
3110
  timer = null;
3110
- signals.forEach(function (signal) {
3111
- signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
3112
- });
3113
- signals = null;
3114
- }
3115
- };
3116
- signals.forEach(function (signal) {
3117
- return signal && signal.addEventListener && signal.addEventListener('abort', onabort);
3118
- });
3119
- var signal = controller.signal;
3120
- signal.unsubscribe = unsubscribe;
3121
- return [signal, function () {
3122
- timer && clearTimeout(timer);
3123
- timer = null;
3124
- }];
3111
+ onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
3112
+ }, timeout);
3113
+ var unsubscribe = function unsubscribe() {
3114
+ if (signals) {
3115
+ timer && clearTimeout(timer);
3116
+ timer = null;
3117
+ signals.forEach(function (signal) {
3118
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3119
+ });
3120
+ signals = null;
3121
+ }
3122
+ };
3123
+ signals.forEach(function (signal) {
3124
+ return signal.addEventListener('abort', onabort);
3125
+ });
3126
+ var signal = controller.signal;
3127
+ signal.unsubscribe = function () {
3128
+ return utils$1.asap(unsubscribe);
3129
+ };
3130
+ return signal;
3131
+ }
3125
3132
  };
3126
3133
  var composeSignals$1 = composeSignals;
3127
3134
 
@@ -3374,6 +3381,7 @@
3374
3381
  }(new Response());
3375
3382
  var getBodyLength = /*#__PURE__*/function () {
3376
3383
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
3384
+ var _request;
3377
3385
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3378
3386
  while (1) switch (_context2.prev = _context2.next) {
3379
3387
  case 0:
@@ -3390,32 +3398,36 @@
3390
3398
  return _context2.abrupt("return", body.size);
3391
3399
  case 4:
3392
3400
  if (!utils$1.isSpecCompliantForm(body)) {
3393
- _context2.next = 8;
3401
+ _context2.next = 9;
3394
3402
  break;
3395
3403
  }
3396
- _context2.next = 7;
3397
- return new Request(body).arrayBuffer();
3398
- case 7:
3399
- return _context2.abrupt("return", _context2.sent.byteLength);
3404
+ _request = new Request(platform.origin, {
3405
+ method: 'POST',
3406
+ body: body
3407
+ });
3408
+ _context2.next = 8;
3409
+ return _request.arrayBuffer();
3400
3410
  case 8:
3411
+ return _context2.abrupt("return", _context2.sent.byteLength);
3412
+ case 9:
3401
3413
  if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
3402
- _context2.next = 10;
3414
+ _context2.next = 11;
3403
3415
  break;
3404
3416
  }
3405
3417
  return _context2.abrupt("return", body.byteLength);
3406
- case 10:
3418
+ case 11:
3407
3419
  if (utils$1.isURLSearchParams(body)) {
3408
3420
  body = body + '';
3409
3421
  }
3410
3422
  if (!utils$1.isString(body)) {
3411
- _context2.next = 15;
3423
+ _context2.next = 16;
3412
3424
  break;
3413
3425
  }
3414
- _context2.next = 14;
3426
+ _context2.next = 15;
3415
3427
  return encodeText(body);
3416
- case 14:
3417
- return _context2.abrupt("return", _context2.sent.byteLength);
3418
3428
  case 15:
3429
+ return _context2.abrupt("return", _context2.sent.byteLength);
3430
+ case 16:
3419
3431
  case "end":
3420
3432
  return _context2.stop();
3421
3433
  }
@@ -3445,18 +3457,15 @@
3445
3457
  }();
3446
3458
  var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
3447
3459
  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;
3460
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, response, isStreamResponse, options, responseContentLength, _ref5, _ref6, _onProgress, _flush, responseData;
3449
3461
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3450
3462
  while (1) switch (_context4.prev = _context4.next) {
3451
3463
  case 0:
3452
3464
  _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
3453
3465
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3454
- _ref5 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref6 = _slicedToArray(_ref5, 2), composedSignal = _ref6[0], stopTimeout = _ref6[1];
3455
- onFinish = function onFinish() {
3456
- !finished && setTimeout(function () {
3457
- composedSignal && composedSignal.unsubscribe();
3458
- });
3459
- finished = true;
3466
+ composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3467
+ unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3468
+ composedSignal.unsubscribe();
3460
3469
  };
3461
3470
  _context4.prev = 4;
3462
3471
  _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
@@ -3490,38 +3499,41 @@
3490
3499
  if (!utils$1.isString(withCredentials)) {
3491
3500
  withCredentials = withCredentials ? 'include' : 'omit';
3492
3501
  }
3502
+
3503
+ // Cloudflare Workers throws when credentials are defined
3504
+ // see https://github.com/cloudflare/workerd/issues/902
3505
+ isCredentialsSupported = "credentials" in Request.prototype;
3493
3506
  request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3494
3507
  signal: composedSignal,
3495
3508
  method: method.toUpperCase(),
3496
3509
  headers: headers.normalize().toJSON(),
3497
3510
  body: data,
3498
3511
  duplex: "half",
3499
- credentials: withCredentials
3512
+ credentials: isCredentialsSupported ? withCredentials : undefined
3500
3513
  }));
3501
- _context4.next = 19;
3514
+ _context4.next = 20;
3502
3515
  return fetch(request);
3503
- case 19:
3516
+ case 20:
3504
3517
  response = _context4.sent;
3505
3518
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3506
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
3519
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3507
3520
  options = {};
3508
3521
  ['status', 'statusText', 'headers'].forEach(function (prop) {
3509
3522
  options[prop] = response[prop];
3510
3523
  });
3511
3524
  responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3512
- _ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
3525
+ _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
3513
3526
  response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3514
3527
  _flush && _flush();
3515
- isStreamResponse && onFinish();
3528
+ unsubscribe && unsubscribe();
3516
3529
  }, encodeText), options);
3517
3530
  }
3518
3531
  responseType = responseType || 'text';
3519
- _context4.next = 25;
3532
+ _context4.next = 26;
3520
3533
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3521
- case 25:
3534
+ case 26:
3522
3535
  responseData = _context4.sent;
3523
- !isStreamResponse && onFinish();
3524
- stopTimeout && stopTimeout();
3536
+ !isStreamResponse && unsubscribe && unsubscribe();
3525
3537
  _context4.next = 30;
3526
3538
  return new Promise(function (resolve, reject) {
3527
3539
  settle(resolve, reject, {
@@ -3538,7 +3550,7 @@
3538
3550
  case 33:
3539
3551
  _context4.prev = 33;
3540
3552
  _context4.t2 = _context4["catch"](4);
3541
- onFinish();
3553
+ unsubscribe && unsubscribe();
3542
3554
  if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
3543
3555
  _context4.next = 38;
3544
3556
  break;
@@ -3676,7 +3688,7 @@
3676
3688
  });
3677
3689
  }
3678
3690
 
3679
- var VERSION = "1.7.4";
3691
+ var VERSION = "1.7.6";
3680
3692
 
3681
3693
  var validators$1 = {};
3682
3694
 
@@ -4057,6 +4069,20 @@
4057
4069
  this._listeners.splice(index, 1);
4058
4070
  }
4059
4071
  }
4072
+ }, {
4073
+ key: "toAbortSignal",
4074
+ value: function toAbortSignal() {
4075
+ var _this = this;
4076
+ var controller = new AbortController();
4077
+ var abort = function abort(err) {
4078
+ controller.abort(err);
4079
+ };
4080
+ this.subscribe(abort);
4081
+ controller.signal.unsubscribe = function () {
4082
+ return _this.unsubscribe(abort);
4083
+ };
4084
+ return controller.signal;
4085
+ }
4060
4086
 
4061
4087
  /**
4062
4088
  * Returns an object that contains a new `CancelToken` and a function that, when called,