axios 1.7.5 → 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 +14 -0
- package/README.md +4 -3
- package/dist/axios.js +84 -65
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +62 -50
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +62 -50
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +62 -50
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +15 -18
- package/lib/cancel/CancelToken.js +14 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/composeSignals.js +31 -29
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
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=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+98/-46 (#6582 )")
|
14
|
+
- <img src="https://avatars.githubusercontent.com/u/3534453?v=4&s=18" alt="avatar" width="18"/> [Jacques Germishuys](https://github.com/jacquesg "+5/-1 (#6524 )")
|
15
|
+
- <img src="https://avatars.githubusercontent.com/u/53894505?v=4&s=18" alt="avatar" width="18"/> [kuroino721](https://github.com/kuroino721 "+3/-1 (#6575 )")
|
16
|
+
|
3
17
|
## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
|
4
18
|
|
5
19
|
|
package/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
|
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://
|
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=axios&utm_medium=sponsorlist&utm_campaign=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'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=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=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=oss-sponsorship&utm_medium=paid_sponsorship&utm_content=website-link&utm_campaign=axios-http"><b>Website</b></a> | <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</b></a> </p>
|
3
4
|
</td><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source=axios&utm_medium=sponsorlist&utm_campaign=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=axios&utm_medium=referral&utm_campaign=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'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'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=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> | <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> </p>
|
5
|
-
</td
|
5
|
+
</td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source=axios&utm_medium=referral&utm_campaign=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'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'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=axios&utm_medium=referral&utm_campaign=axios-oss-sponsorship"><b>Website</b></a> | <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> </p>
|
6
|
+
</td><td align="center" width="33.333333333333336%"> <a href="https://route4me.com/?utm_source=axios&utm_medium=sponsorlist&utm_campaign=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
7
|
</td></tr></table>
|
7
8
|
|
8
9
|
<!--<div>marker</div>-->
|
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Axios v1.7.
|
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) :
|
@@ -3093,38 +3093,42 @@
|
|
3093
3093
|
};
|
3094
3094
|
|
3095
3095
|
var composeSignals = function composeSignals(signals, timeout) {
|
3096
|
-
var
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
if (signals) {
|
3111
|
-
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 () {
|
3112
3110
|
timer = null;
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
signals
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
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
|
+
}
|
3128
3132
|
};
|
3129
3133
|
var composeSignals$1 = composeSignals;
|
3130
3134
|
|
@@ -3377,6 +3381,7 @@
|
|
3377
3381
|
}(new Response());
|
3378
3382
|
var getBodyLength = /*#__PURE__*/function () {
|
3379
3383
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
|
3384
|
+
var _request;
|
3380
3385
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
3381
3386
|
while (1) switch (_context2.prev = _context2.next) {
|
3382
3387
|
case 0:
|
@@ -3393,32 +3398,36 @@
|
|
3393
3398
|
return _context2.abrupt("return", body.size);
|
3394
3399
|
case 4:
|
3395
3400
|
if (!utils$1.isSpecCompliantForm(body)) {
|
3396
|
-
_context2.next =
|
3401
|
+
_context2.next = 9;
|
3397
3402
|
break;
|
3398
3403
|
}
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3404
|
+
_request = new Request(platform.origin, {
|
3405
|
+
method: 'POST',
|
3406
|
+
body: body
|
3407
|
+
});
|
3408
|
+
_context2.next = 8;
|
3409
|
+
return _request.arrayBuffer();
|
3403
3410
|
case 8:
|
3411
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
3412
|
+
case 9:
|
3404
3413
|
if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
|
3405
|
-
_context2.next =
|
3414
|
+
_context2.next = 11;
|
3406
3415
|
break;
|
3407
3416
|
}
|
3408
3417
|
return _context2.abrupt("return", body.byteLength);
|
3409
|
-
case
|
3418
|
+
case 11:
|
3410
3419
|
if (utils$1.isURLSearchParams(body)) {
|
3411
3420
|
body = body + '';
|
3412
3421
|
}
|
3413
3422
|
if (!utils$1.isString(body)) {
|
3414
|
-
_context2.next =
|
3423
|
+
_context2.next = 16;
|
3415
3424
|
break;
|
3416
3425
|
}
|
3417
|
-
_context2.next =
|
3426
|
+
_context2.next = 15;
|
3418
3427
|
return encodeText(body);
|
3419
|
-
case 14:
|
3420
|
-
return _context2.abrupt("return", _context2.sent.byteLength);
|
3421
3428
|
case 15:
|
3429
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
3430
|
+
case 16:
|
3422
3431
|
case "end":
|
3423
3432
|
return _context2.stop();
|
3424
3433
|
}
|
@@ -3448,18 +3457,15 @@
|
|
3448
3457
|
}();
|
3449
3458
|
var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
|
3450
3459
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
|
3451
|
-
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions,
|
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;
|
3452
3461
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3453
3462
|
while (1) switch (_context4.prev = _context4.next) {
|
3454
3463
|
case 0:
|
3455
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;
|
3456
3465
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
composedSignal && composedSignal.unsubscribe();
|
3461
|
-
});
|
3462
|
-
finished = true;
|
3466
|
+
composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
3467
|
+
unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
|
3468
|
+
composedSignal.unsubscribe();
|
3463
3469
|
};
|
3464
3470
|
_context4.prev = 4;
|
3465
3471
|
_context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
|
@@ -3510,16 +3516,16 @@
|
|
3510
3516
|
case 20:
|
3511
3517
|
response = _context4.sent;
|
3512
3518
|
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
3513
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
3519
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
3514
3520
|
options = {};
|
3515
3521
|
['status', 'statusText', 'headers'].forEach(function (prop) {
|
3516
3522
|
options[prop] = response[prop];
|
3517
3523
|
});
|
3518
3524
|
responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
3519
|
-
|
3525
|
+
_ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
|
3520
3526
|
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
|
3521
3527
|
_flush && _flush();
|
3522
|
-
|
3528
|
+
unsubscribe && unsubscribe();
|
3523
3529
|
}, encodeText), options);
|
3524
3530
|
}
|
3525
3531
|
responseType = responseType || 'text';
|
@@ -3527,9 +3533,8 @@
|
|
3527
3533
|
return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
3528
3534
|
case 26:
|
3529
3535
|
responseData = _context4.sent;
|
3530
|
-
!isStreamResponse &&
|
3531
|
-
|
3532
|
-
_context4.next = 31;
|
3536
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
3537
|
+
_context4.next = 30;
|
3533
3538
|
return new Promise(function (resolve, reject) {
|
3534
3539
|
settle(resolve, reject, {
|
3535
3540
|
data: responseData,
|
@@ -3540,26 +3545,26 @@
|
|
3540
3545
|
request: request
|
3541
3546
|
});
|
3542
3547
|
});
|
3543
|
-
case
|
3548
|
+
case 30:
|
3544
3549
|
return _context4.abrupt("return", _context4.sent);
|
3545
|
-
case
|
3546
|
-
_context4.prev =
|
3550
|
+
case 33:
|
3551
|
+
_context4.prev = 33;
|
3547
3552
|
_context4.t2 = _context4["catch"](4);
|
3548
|
-
|
3553
|
+
unsubscribe && unsubscribe();
|
3549
3554
|
if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
|
3550
|
-
_context4.next =
|
3555
|
+
_context4.next = 38;
|
3551
3556
|
break;
|
3552
3557
|
}
|
3553
3558
|
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
3554
3559
|
cause: _context4.t2.cause || _context4.t2
|
3555
3560
|
});
|
3556
|
-
case
|
3561
|
+
case 38:
|
3557
3562
|
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
3558
|
-
case
|
3563
|
+
case 39:
|
3559
3564
|
case "end":
|
3560
3565
|
return _context4.stop();
|
3561
3566
|
}
|
3562
|
-
}, _callee4, null, [[4,
|
3567
|
+
}, _callee4, null, [[4, 33]]);
|
3563
3568
|
}));
|
3564
3569
|
return function (_x5) {
|
3565
3570
|
return _ref4.apply(this, arguments);
|
@@ -3683,7 +3688,7 @@
|
|
3683
3688
|
});
|
3684
3689
|
}
|
3685
3690
|
|
3686
|
-
var VERSION = "1.7.
|
3691
|
+
var VERSION = "1.7.6";
|
3687
3692
|
|
3688
3693
|
var validators$1 = {};
|
3689
3694
|
|
@@ -4064,6 +4069,20 @@
|
|
4064
4069
|
this._listeners.splice(index, 1);
|
4065
4070
|
}
|
4066
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
|
+
}
|
4067
4086
|
|
4068
4087
|
/**
|
4069
4088
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|