axios 1.7.5 → 1.7.7
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 +27 -0
- package/README.md +4 -3
- package/dist/axios.js +179 -131
- 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 +89 -57
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +89 -57
- 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 +90 -58
- package/dist/node/axios.cjs.map +1 -1
- package/lib/adapters/fetch.js +17 -20
- package/lib/adapters/http.js +1 -1
- package/lib/cancel/CancelToken.js +14 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/composeSignals.js +31 -29
- package/lib/helpers/trackStream.js +25 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.7.7](https://github.com/axios/axios/compare/v1.7.6...v1.7.7) (2024-08-31)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **fetch:** fix stream handling in Safari by fallback to using a stream reader instead of an async iterator; ([#6584](https://github.com/axios/axios/issues/6584)) ([d198085](https://github.com/axios/axios/commit/d1980854fee1765cd02fa0787adf5d6e34dd9dcf))
|
9
|
+
* **http:** fixed support for IPv6 literal strings in url ([#5731](https://github.com/axios/axios/issues/5731)) ([364993f](https://github.com/axios/axios/commit/364993f0d8bc6e0e06f76b8a35d2d0a35cab054c))
|
10
|
+
|
11
|
+
### Contributors to this release
|
12
|
+
|
13
|
+
- <img src="https://avatars.githubusercontent.com/u/10539109?v=4&s=18" alt="avatar" width="18"/> [Rishi556](https://github.com/Rishi556 "+39/-1 (#5731 )")
|
14
|
+
- <img src="https://avatars.githubusercontent.com/u/12586868?v=4&s=18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-7 (#6584 )")
|
15
|
+
|
16
|
+
## [1.7.6](https://github.com/axios/axios/compare/v1.7.5...v1.7.6) (2024-08-30)
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* **fetch:** fix content length calculation for FormData payload; ([#6524](https://github.com/axios/axios/issues/6524)) ([085f568](https://github.com/axios/axios/commit/085f56861a83e9ac02c140ad9d68dac540dfeeaa))
|
22
|
+
* **fetch:** optimize signals composing logic; ([#6582](https://github.com/axios/axios/issues/6582)) ([df9889b](https://github.com/axios/axios/commit/df9889b83c2cc37e9e6189675a73ab70c60f031f))
|
23
|
+
|
24
|
+
### Contributors to this release
|
25
|
+
|
26
|
+
- <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 )")
|
27
|
+
- <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 )")
|
28
|
+
- <img src="https://avatars.githubusercontent.com/u/53894505?v=4&s=18" alt="avatar" width="18"/> [kuroino721](https://github.com/kuroino721 "+3/-1 (#6575 )")
|
29
|
+
|
3
30
|
## [1.7.5](https://github.com/axios/axios/compare/v1.7.4...v1.7.5) (2024-08-23)
|
4
31
|
|
5
32
|
|
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.7 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
|
|
@@ -3163,7 +3167,7 @@
|
|
3163
3167
|
}, streamChunk);
|
3164
3168
|
});
|
3165
3169
|
var readBytes = /*#__PURE__*/function () {
|
3166
|
-
var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize
|
3170
|
+
var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize) {
|
3167
3171
|
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
3168
3172
|
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
3169
3173
|
while (1) switch (_context2.prev = _context2.next) {
|
@@ -3171,82 +3175,111 @@
|
|
3171
3175
|
_iteratorAbruptCompletion = false;
|
3172
3176
|
_didIteratorError = false;
|
3173
3177
|
_context2.prev = 2;
|
3174
|
-
_iterator = _asyncIterator(iterable);
|
3178
|
+
_iterator = _asyncIterator(readStream(iterable));
|
3175
3179
|
case 4:
|
3176
3180
|
_context2.next = 6;
|
3177
3181
|
return _awaitAsyncGenerator(_iterator.next());
|
3178
3182
|
case 6:
|
3179
3183
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
3180
|
-
_context2.next =
|
3184
|
+
_context2.next = 12;
|
3181
3185
|
break;
|
3182
3186
|
}
|
3183
3187
|
chunk = _step.value;
|
3184
|
-
_context2.t0
|
3185
|
-
|
3186
|
-
_context2.t2 = streamChunk;
|
3187
|
-
if (!ArrayBuffer.isView(chunk)) {
|
3188
|
-
_context2.next = 15;
|
3189
|
-
break;
|
3190
|
-
}
|
3191
|
-
_context2.t3 = chunk;
|
3192
|
-
_context2.next = 18;
|
3193
|
-
break;
|
3194
|
-
case 15:
|
3195
|
-
_context2.next = 17;
|
3196
|
-
return _awaitAsyncGenerator(encode(String(chunk)));
|
3197
|
-
case 17:
|
3198
|
-
_context2.t3 = _context2.sent;
|
3199
|
-
case 18:
|
3200
|
-
_context2.t4 = _context2.t3;
|
3201
|
-
_context2.t5 = chunkSize;
|
3202
|
-
_context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
|
3203
|
-
_context2.t7 = (0, _context2.t1)(_context2.t6);
|
3204
|
-
_context2.t8 = _awaitAsyncGenerator;
|
3205
|
-
return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
|
3206
|
-
case 24:
|
3188
|
+
return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(streamChunk(chunk, chunkSize))), "t0", 9);
|
3189
|
+
case 9:
|
3207
3190
|
_iteratorAbruptCompletion = false;
|
3208
3191
|
_context2.next = 4;
|
3209
3192
|
break;
|
3210
|
-
case
|
3211
|
-
_context2.next =
|
3193
|
+
case 12:
|
3194
|
+
_context2.next = 18;
|
3212
3195
|
break;
|
3213
|
-
case
|
3214
|
-
_context2.prev =
|
3215
|
-
_context2.
|
3196
|
+
case 14:
|
3197
|
+
_context2.prev = 14;
|
3198
|
+
_context2.t1 = _context2["catch"](2);
|
3216
3199
|
_didIteratorError = true;
|
3217
|
-
_iteratorError = _context2.
|
3218
|
-
case
|
3219
|
-
_context2.prev =
|
3220
|
-
_context2.prev =
|
3200
|
+
_iteratorError = _context2.t1;
|
3201
|
+
case 18:
|
3202
|
+
_context2.prev = 18;
|
3203
|
+
_context2.prev = 19;
|
3221
3204
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
3222
|
-
_context2.next =
|
3205
|
+
_context2.next = 23;
|
3223
3206
|
break;
|
3224
3207
|
}
|
3225
|
-
_context2.next =
|
3208
|
+
_context2.next = 23;
|
3226
3209
|
return _awaitAsyncGenerator(_iterator["return"]());
|
3227
|
-
case
|
3228
|
-
_context2.prev =
|
3210
|
+
case 23:
|
3211
|
+
_context2.prev = 23;
|
3229
3212
|
if (!_didIteratorError) {
|
3230
|
-
_context2.next =
|
3213
|
+
_context2.next = 26;
|
3231
3214
|
break;
|
3232
3215
|
}
|
3233
3216
|
throw _iteratorError;
|
3234
|
-
case
|
3235
|
-
return _context2.finish(
|
3236
|
-
case
|
3237
|
-
return _context2.finish(
|
3238
|
-
case
|
3217
|
+
case 26:
|
3218
|
+
return _context2.finish(23);
|
3219
|
+
case 27:
|
3220
|
+
return _context2.finish(18);
|
3221
|
+
case 28:
|
3239
3222
|
case "end":
|
3240
3223
|
return _context2.stop();
|
3241
3224
|
}
|
3242
|
-
}, _callee, null, [[2,
|
3225
|
+
}, _callee, null, [[2, 14, 18, 28], [19,, 23, 27]]);
|
3243
3226
|
}));
|
3244
|
-
return function readBytes(_x, _x2
|
3227
|
+
return function readBytes(_x, _x2) {
|
3245
3228
|
return _ref.apply(this, arguments);
|
3246
3229
|
};
|
3247
3230
|
}();
|
3248
|
-
var
|
3249
|
-
var
|
3231
|
+
var readStream = /*#__PURE__*/function () {
|
3232
|
+
var _ref2 = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
|
3233
|
+
var reader, _yield$_awaitAsyncGen, done, value;
|
3234
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
3235
|
+
while (1) switch (_context3.prev = _context3.next) {
|
3236
|
+
case 0:
|
3237
|
+
if (!stream[Symbol.asyncIterator]) {
|
3238
|
+
_context3.next = 3;
|
3239
|
+
break;
|
3240
|
+
}
|
3241
|
+
return _context3.delegateYield(_asyncGeneratorDelegate(_asyncIterator(stream)), "t0", 2);
|
3242
|
+
case 2:
|
3243
|
+
return _context3.abrupt("return");
|
3244
|
+
case 3:
|
3245
|
+
reader = stream.getReader();
|
3246
|
+
_context3.prev = 4;
|
3247
|
+
case 5:
|
3248
|
+
_context3.next = 7;
|
3249
|
+
return _awaitAsyncGenerator(reader.read());
|
3250
|
+
case 7:
|
3251
|
+
_yield$_awaitAsyncGen = _context3.sent;
|
3252
|
+
done = _yield$_awaitAsyncGen.done;
|
3253
|
+
value = _yield$_awaitAsyncGen.value;
|
3254
|
+
if (!done) {
|
3255
|
+
_context3.next = 12;
|
3256
|
+
break;
|
3257
|
+
}
|
3258
|
+
return _context3.abrupt("break", 16);
|
3259
|
+
case 12:
|
3260
|
+
_context3.next = 14;
|
3261
|
+
return value;
|
3262
|
+
case 14:
|
3263
|
+
_context3.next = 5;
|
3264
|
+
break;
|
3265
|
+
case 16:
|
3266
|
+
_context3.prev = 16;
|
3267
|
+
_context3.next = 19;
|
3268
|
+
return _awaitAsyncGenerator(reader.cancel());
|
3269
|
+
case 19:
|
3270
|
+
return _context3.finish(16);
|
3271
|
+
case 20:
|
3272
|
+
case "end":
|
3273
|
+
return _context3.stop();
|
3274
|
+
}
|
3275
|
+
}, _callee2, null, [[4,, 16, 20]]);
|
3276
|
+
}));
|
3277
|
+
return function readStream(_x3) {
|
3278
|
+
return _ref2.apply(this, arguments);
|
3279
|
+
};
|
3280
|
+
}();
|
3281
|
+
var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish) {
|
3282
|
+
var iterator = readBytes(stream, chunkSize);
|
3250
3283
|
var bytes = 0;
|
3251
3284
|
var done;
|
3252
3285
|
var _onFinish = function _onFinish(e) {
|
@@ -3257,25 +3290,25 @@
|
|
3257
3290
|
};
|
3258
3291
|
return new ReadableStream({
|
3259
3292
|
pull: function pull(controller) {
|
3260
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3293
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
3261
3294
|
var _yield$iterator$next, _done, value, len, loadedBytes;
|
3262
|
-
return _regeneratorRuntime().wrap(function
|
3263
|
-
while (1) switch (
|
3295
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
3296
|
+
while (1) switch (_context4.prev = _context4.next) {
|
3264
3297
|
case 0:
|
3265
|
-
|
3266
|
-
|
3298
|
+
_context4.prev = 0;
|
3299
|
+
_context4.next = 3;
|
3267
3300
|
return iterator.next();
|
3268
3301
|
case 3:
|
3269
|
-
_yield$iterator$next =
|
3302
|
+
_yield$iterator$next = _context4.sent;
|
3270
3303
|
_done = _yield$iterator$next.done;
|
3271
3304
|
value = _yield$iterator$next.value;
|
3272
3305
|
if (!_done) {
|
3273
|
-
|
3306
|
+
_context4.next = 10;
|
3274
3307
|
break;
|
3275
3308
|
}
|
3276
3309
|
_onFinish();
|
3277
3310
|
controller.close();
|
3278
|
-
return
|
3311
|
+
return _context4.abrupt("return");
|
3279
3312
|
case 10:
|
3280
3313
|
len = value.byteLength;
|
3281
3314
|
if (onProgress) {
|
@@ -3283,18 +3316,18 @@
|
|
3283
3316
|
onProgress(loadedBytes);
|
3284
3317
|
}
|
3285
3318
|
controller.enqueue(new Uint8Array(value));
|
3286
|
-
|
3319
|
+
_context4.next = 19;
|
3287
3320
|
break;
|
3288
3321
|
case 15:
|
3289
|
-
|
3290
|
-
|
3291
|
-
_onFinish(
|
3292
|
-
throw
|
3322
|
+
_context4.prev = 15;
|
3323
|
+
_context4.t0 = _context4["catch"](0);
|
3324
|
+
_onFinish(_context4.t0);
|
3325
|
+
throw _context4.t0;
|
3293
3326
|
case 19:
|
3294
3327
|
case "end":
|
3295
|
-
return
|
3328
|
+
return _context4.stop();
|
3296
3329
|
}
|
3297
|
-
},
|
3330
|
+
}, _callee3, null, [[0, 15]]);
|
3298
3331
|
}))();
|
3299
3332
|
},
|
3300
3333
|
cancel: function cancel(reason) {
|
@@ -3377,6 +3410,7 @@
|
|
3377
3410
|
}(new Response());
|
3378
3411
|
var getBodyLength = /*#__PURE__*/function () {
|
3379
3412
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
|
3413
|
+
var _request;
|
3380
3414
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
3381
3415
|
while (1) switch (_context2.prev = _context2.next) {
|
3382
3416
|
case 0:
|
@@ -3393,32 +3427,36 @@
|
|
3393
3427
|
return _context2.abrupt("return", body.size);
|
3394
3428
|
case 4:
|
3395
3429
|
if (!utils$1.isSpecCompliantForm(body)) {
|
3396
|
-
_context2.next =
|
3430
|
+
_context2.next = 9;
|
3397
3431
|
break;
|
3398
3432
|
}
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3433
|
+
_request = new Request(platform.origin, {
|
3434
|
+
method: 'POST',
|
3435
|
+
body: body
|
3436
|
+
});
|
3437
|
+
_context2.next = 8;
|
3438
|
+
return _request.arrayBuffer();
|
3403
3439
|
case 8:
|
3440
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
3441
|
+
case 9:
|
3404
3442
|
if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
|
3405
|
-
_context2.next =
|
3443
|
+
_context2.next = 11;
|
3406
3444
|
break;
|
3407
3445
|
}
|
3408
3446
|
return _context2.abrupt("return", body.byteLength);
|
3409
|
-
case
|
3447
|
+
case 11:
|
3410
3448
|
if (utils$1.isURLSearchParams(body)) {
|
3411
3449
|
body = body + '';
|
3412
3450
|
}
|
3413
3451
|
if (!utils$1.isString(body)) {
|
3414
|
-
_context2.next =
|
3452
|
+
_context2.next = 16;
|
3415
3453
|
break;
|
3416
3454
|
}
|
3417
|
-
_context2.next =
|
3455
|
+
_context2.next = 15;
|
3418
3456
|
return encodeText(body);
|
3419
|
-
case 14:
|
3420
|
-
return _context2.abrupt("return", _context2.sent.byteLength);
|
3421
3457
|
case 15:
|
3458
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
3459
|
+
case 16:
|
3422
3460
|
case "end":
|
3423
3461
|
return _context2.stop();
|
3424
3462
|
}
|
@@ -3448,18 +3486,15 @@
|
|
3448
3486
|
}();
|
3449
3487
|
var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
|
3450
3488
|
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,
|
3489
|
+
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
3490
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3453
3491
|
while (1) switch (_context4.prev = _context4.next) {
|
3454
3492
|
case 0:
|
3455
3493
|
_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
3494
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
composedSignal && composedSignal.unsubscribe();
|
3461
|
-
});
|
3462
|
-
finished = true;
|
3495
|
+
composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
3496
|
+
unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
|
3497
|
+
composedSignal.unsubscribe();
|
3463
3498
|
};
|
3464
3499
|
_context4.prev = 4;
|
3465
3500
|
_context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
|
@@ -3487,7 +3522,7 @@
|
|
3487
3522
|
}
|
3488
3523
|
if (_request.body) {
|
3489
3524
|
_progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
|
3490
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush
|
3525
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
3491
3526
|
}
|
3492
3527
|
case 15:
|
3493
3528
|
if (!utils$1.isString(withCredentials)) {
|
@@ -3510,26 +3545,25 @@
|
|
3510
3545
|
case 20:
|
3511
3546
|
response = _context4.sent;
|
3512
3547
|
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
3513
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
3548
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
3514
3549
|
options = {};
|
3515
3550
|
['status', 'statusText', 'headers'].forEach(function (prop) {
|
3516
3551
|
options[prop] = response[prop];
|
3517
3552
|
});
|
3518
3553
|
responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
3519
|
-
|
3554
|
+
_ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
|
3520
3555
|
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
|
3521
3556
|
_flush && _flush();
|
3522
|
-
|
3523
|
-
}
|
3557
|
+
unsubscribe && unsubscribe();
|
3558
|
+
}), options);
|
3524
3559
|
}
|
3525
3560
|
responseType = responseType || 'text';
|
3526
3561
|
_context4.next = 26;
|
3527
3562
|
return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
3528
3563
|
case 26:
|
3529
3564
|
responseData = _context4.sent;
|
3530
|
-
!isStreamResponse &&
|
3531
|
-
|
3532
|
-
_context4.next = 31;
|
3565
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
3566
|
+
_context4.next = 30;
|
3533
3567
|
return new Promise(function (resolve, reject) {
|
3534
3568
|
settle(resolve, reject, {
|
3535
3569
|
data: responseData,
|
@@ -3540,26 +3574,26 @@
|
|
3540
3574
|
request: request
|
3541
3575
|
});
|
3542
3576
|
});
|
3543
|
-
case
|
3577
|
+
case 30:
|
3544
3578
|
return _context4.abrupt("return", _context4.sent);
|
3545
|
-
case
|
3546
|
-
_context4.prev =
|
3579
|
+
case 33:
|
3580
|
+
_context4.prev = 33;
|
3547
3581
|
_context4.t2 = _context4["catch"](4);
|
3548
|
-
|
3582
|
+
unsubscribe && unsubscribe();
|
3549
3583
|
if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
|
3550
|
-
_context4.next =
|
3584
|
+
_context4.next = 38;
|
3551
3585
|
break;
|
3552
3586
|
}
|
3553
3587
|
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
3554
3588
|
cause: _context4.t2.cause || _context4.t2
|
3555
3589
|
});
|
3556
|
-
case
|
3590
|
+
case 38:
|
3557
3591
|
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
3558
|
-
case
|
3592
|
+
case 39:
|
3559
3593
|
case "end":
|
3560
3594
|
return _context4.stop();
|
3561
3595
|
}
|
3562
|
-
}, _callee4, null, [[4,
|
3596
|
+
}, _callee4, null, [[4, 33]]);
|
3563
3597
|
}));
|
3564
3598
|
return function (_x5) {
|
3565
3599
|
return _ref4.apply(this, arguments);
|
@@ -3683,7 +3717,7 @@
|
|
3683
3717
|
});
|
3684
3718
|
}
|
3685
3719
|
|
3686
|
-
var VERSION = "1.7.
|
3720
|
+
var VERSION = "1.7.7";
|
3687
3721
|
|
3688
3722
|
var validators$1 = {};
|
3689
3723
|
|
@@ -4064,6 +4098,20 @@
|
|
4064
4098
|
this._listeners.splice(index, 1);
|
4065
4099
|
}
|
4066
4100
|
}
|
4101
|
+
}, {
|
4102
|
+
key: "toAbortSignal",
|
4103
|
+
value: function toAbortSignal() {
|
4104
|
+
var _this = this;
|
4105
|
+
var controller = new AbortController();
|
4106
|
+
var abort = function abort(err) {
|
4107
|
+
controller.abort(err);
|
4108
|
+
};
|
4109
|
+
this.subscribe(abort);
|
4110
|
+
controller.signal.unsubscribe = function () {
|
4111
|
+
return _this.unsubscribe(abort);
|
4112
|
+
};
|
4113
|
+
return controller.signal;
|
4114
|
+
}
|
4067
4115
|
|
4068
4116
|
/**
|
4069
4117
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|