axios 1.8.4 → 1.10.0
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.
- package/CHANGELOG.md +51 -0
- package/README.md +24 -21
- package/dist/axios.js +36 -17
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.js.map +1 -1
- package/dist/browser/axios.cjs +36 -14
- package/dist/browser/axios.cjs.map +1 -1
- package/dist/esm/axios.js +36 -14
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +2 -2
- package/dist/esm/axios.min.js.map +1 -1
- package/dist/node/axios.cjs +37 -15
- package/dist/node/axios.cjs.map +1 -1
- package/index.d.cts +3 -3
- package/index.d.ts +5 -3
- package/lib/adapters/fetch.js +2 -2
- package/lib/core/Axios.js +1 -1
- package/lib/core/AxiosHeaders.js +15 -3
- package/lib/env/data.js +1 -1
- package/lib/helpers/formDataToStream.js +1 -1
- package/lib/helpers/toFormData.js +4 -0
- package/lib/utils.js +12 -6
- package/package.json +13 -4
package/dist/node/axios.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Axios v1.
|
|
1
|
+
/*! Axios v1.10.0 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const FormData$1 = require('form-data');
|
|
@@ -36,6 +36,7 @@ function bind(fn, thisArg) {
|
|
|
36
36
|
|
|
37
37
|
const {toString} = Object.prototype;
|
|
38
38
|
const {getPrototypeOf} = Object;
|
|
39
|
+
const {iterator, toStringTag} = Symbol;
|
|
39
40
|
|
|
40
41
|
const kindOf = (cache => thing => {
|
|
41
42
|
const str = toString.call(thing);
|
|
@@ -162,7 +163,7 @@ const isPlainObject = (val) => {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
const prototype = getPrototypeOf(val);
|
|
165
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(
|
|
166
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
166
167
|
};
|
|
167
168
|
|
|
168
169
|
/**
|
|
@@ -513,13 +514,13 @@ const isTypedArray = (TypedArray => {
|
|
|
513
514
|
* @returns {void}
|
|
514
515
|
*/
|
|
515
516
|
const forEachEntry = (obj, fn) => {
|
|
516
|
-
const generator = obj && obj[
|
|
517
|
+
const generator = obj && obj[iterator];
|
|
517
518
|
|
|
518
|
-
const
|
|
519
|
+
const _iterator = generator.call(obj);
|
|
519
520
|
|
|
520
521
|
let result;
|
|
521
522
|
|
|
522
|
-
while ((result =
|
|
523
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
523
524
|
const pair = result.value;
|
|
524
525
|
fn.call(obj, pair[0], pair[1]);
|
|
525
526
|
}
|
|
@@ -640,7 +641,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
640
641
|
* @returns {boolean}
|
|
641
642
|
*/
|
|
642
643
|
function isSpecCompliantForm(thing) {
|
|
643
|
-
return !!(thing && isFunction(thing.append) && thing[
|
|
644
|
+
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
644
645
|
}
|
|
645
646
|
|
|
646
647
|
const toJSONObject = (obj) => {
|
|
@@ -709,6 +710,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
709
710
|
|
|
710
711
|
// *********************
|
|
711
712
|
|
|
713
|
+
|
|
714
|
+
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
715
|
+
|
|
716
|
+
|
|
712
717
|
const utils$1 = {
|
|
713
718
|
isArray,
|
|
714
719
|
isArrayBuffer,
|
|
@@ -764,7 +769,8 @@ const utils$1 = {
|
|
|
764
769
|
isAsyncFn,
|
|
765
770
|
isThenable,
|
|
766
771
|
setImmediate: _setImmediate,
|
|
767
|
-
asap
|
|
772
|
+
asap,
|
|
773
|
+
isIterable
|
|
768
774
|
};
|
|
769
775
|
|
|
770
776
|
/**
|
|
@@ -980,6 +986,10 @@ function toFormData(obj, formData, options) {
|
|
|
980
986
|
return value.toISOString();
|
|
981
987
|
}
|
|
982
988
|
|
|
989
|
+
if (utils$1.isBoolean(value)) {
|
|
990
|
+
return value.toString();
|
|
991
|
+
}
|
|
992
|
+
|
|
983
993
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
984
994
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
985
995
|
}
|
|
@@ -1767,10 +1777,18 @@ class AxiosHeaders {
|
|
|
1767
1777
|
setHeaders(header, valueOrRewrite);
|
|
1768
1778
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1769
1779
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1770
|
-
} else if (utils$1.
|
|
1771
|
-
|
|
1772
|
-
|
|
1780
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
1781
|
+
let obj = {}, dest, key;
|
|
1782
|
+
for (const entry of header) {
|
|
1783
|
+
if (!utils$1.isArray(entry)) {
|
|
1784
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
obj[key = entry[0]] = (dest = obj[key]) ?
|
|
1788
|
+
(utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
|
|
1773
1789
|
}
|
|
1790
|
+
|
|
1791
|
+
setHeaders(obj, valueOrRewrite);
|
|
1774
1792
|
} else {
|
|
1775
1793
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1776
1794
|
}
|
|
@@ -1912,6 +1930,10 @@ class AxiosHeaders {
|
|
|
1912
1930
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
1913
1931
|
}
|
|
1914
1932
|
|
|
1933
|
+
getSetCookie() {
|
|
1934
|
+
return this.get("set-cookie") || [];
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1915
1937
|
get [Symbol.toStringTag]() {
|
|
1916
1938
|
return 'AxiosHeaders';
|
|
1917
1939
|
}
|
|
@@ -2084,7 +2106,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2084
2106
|
return requestedURL;
|
|
2085
2107
|
}
|
|
2086
2108
|
|
|
2087
|
-
const VERSION = "1.
|
|
2109
|
+
const VERSION = "1.10.0";
|
|
2088
2110
|
|
|
2089
2111
|
function parseProtocol(url) {
|
|
2090
2112
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -2366,7 +2388,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
2366
2388
|
}
|
|
2367
2389
|
|
|
2368
2390
|
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
2369
|
-
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF
|
|
2391
|
+
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
|
|
2370
2392
|
let contentLength = footerBytes.byteLength;
|
|
2371
2393
|
|
|
2372
2394
|
const parts = Array.from(form.entries()).map(([name, value]) => {
|
|
@@ -3921,7 +3943,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3921
3943
|
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3922
3944
|
});
|
|
3923
3945
|
|
|
3924
|
-
let response = await fetch(request);
|
|
3946
|
+
let response = await fetch(request, fetchOptions);
|
|
3925
3947
|
|
|
3926
3948
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3927
3949
|
|
|
@@ -3967,7 +3989,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3967
3989
|
} catch (err) {
|
|
3968
3990
|
unsubscribe && unsubscribe();
|
|
3969
3991
|
|
|
3970
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
3992
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3971
3993
|
throw Object.assign(
|
|
3972
3994
|
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
3973
3995
|
{
|
|
@@ -4233,7 +4255,7 @@ const validators = validator.validators;
|
|
|
4233
4255
|
*/
|
|
4234
4256
|
class Axios {
|
|
4235
4257
|
constructor(instanceConfig) {
|
|
4236
|
-
this.defaults = instanceConfig;
|
|
4258
|
+
this.defaults = instanceConfig || {};
|
|
4237
4259
|
this.interceptors = {
|
|
4238
4260
|
request: new InterceptorManager$1(),
|
|
4239
4261
|
response: new InterceptorManager$1()
|