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/dist/esm/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Axios v1.8.4 Copyright (c) 2025 Matt Zabriskie and contributors */
1
+ /*! Axios v1.10.0 Copyright (c) 2025 Matt Zabriskie and contributors */
2
2
  function bind(fn, thisArg) {
3
3
  return function wrap() {
4
4
  return fn.apply(thisArg, arguments);
@@ -9,6 +9,7 @@ function bind(fn, thisArg) {
9
9
 
10
10
  const {toString} = Object.prototype;
11
11
  const {getPrototypeOf} = Object;
12
+ const {iterator, toStringTag} = Symbol;
12
13
 
13
14
  const kindOf = (cache => thing => {
14
15
  const str = toString.call(thing);
@@ -135,7 +136,7 @@ const isPlainObject = (val) => {
135
136
  }
136
137
 
137
138
  const prototype = getPrototypeOf(val);
138
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
139
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
139
140
  };
140
141
 
141
142
  /**
@@ -486,13 +487,13 @@ const isTypedArray = (TypedArray => {
486
487
  * @returns {void}
487
488
  */
488
489
  const forEachEntry = (obj, fn) => {
489
- const generator = obj && obj[Symbol.iterator];
490
+ const generator = obj && obj[iterator];
490
491
 
491
- const iterator = generator.call(obj);
492
+ const _iterator = generator.call(obj);
492
493
 
493
494
  let result;
494
495
 
495
- while ((result = iterator.next()) && !result.done) {
496
+ while ((result = _iterator.next()) && !result.done) {
496
497
  const pair = result.value;
497
498
  fn.call(obj, pair[0], pair[1]);
498
499
  }
@@ -613,7 +614,7 @@ const toFiniteNumber = (value, defaultValue) => {
613
614
  * @returns {boolean}
614
615
  */
615
616
  function isSpecCompliantForm(thing) {
616
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
617
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
617
618
  }
618
619
 
619
620
  const toJSONObject = (obj) => {
@@ -682,6 +683,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
682
683
 
683
684
  // *********************
684
685
 
686
+
687
+ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
688
+
689
+
685
690
  const utils$1 = {
686
691
  isArray,
687
692
  isArrayBuffer,
@@ -737,7 +742,8 @@ const utils$1 = {
737
742
  isAsyncFn,
738
743
  isThenable,
739
744
  setImmediate: _setImmediate,
740
- asap
745
+ asap,
746
+ isIterable
741
747
  };
742
748
 
743
749
  /**
@@ -956,6 +962,10 @@ function toFormData$1(obj, formData, options) {
956
962
  return value.toISOString();
957
963
  }
958
964
 
965
+ if (utils$1.isBoolean(value)) {
966
+ return value.toString();
967
+ }
968
+
959
969
  if (!useBlob && utils$1.isBlob(value)) {
960
970
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
961
971
  }
@@ -1722,10 +1732,18 @@ class AxiosHeaders$1 {
1722
1732
  setHeaders(header, valueOrRewrite);
1723
1733
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1724
1734
  setHeaders(parseHeaders(header), valueOrRewrite);
1725
- } else if (utils$1.isHeaders(header)) {
1726
- for (const [key, value] of header.entries()) {
1727
- setHeader(value, key, rewrite);
1735
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1736
+ let obj = {}, dest, key;
1737
+ for (const entry of header) {
1738
+ if (!utils$1.isArray(entry)) {
1739
+ throw TypeError('Object iterator must return a key-value pair');
1740
+ }
1741
+
1742
+ obj[key = entry[0]] = (dest = obj[key]) ?
1743
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1728
1744
  }
1745
+
1746
+ setHeaders(obj, valueOrRewrite);
1729
1747
  } else {
1730
1748
  header != null && setHeader(valueOrRewrite, header, rewrite);
1731
1749
  }
@@ -1867,6 +1885,10 @@ class AxiosHeaders$1 {
1867
1885
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1868
1886
  }
1869
1887
 
1888
+ getSetCookie() {
1889
+ return this.get("set-cookie") || [];
1890
+ }
1891
+
1870
1892
  get [Symbol.toStringTag]() {
1871
1893
  return 'AxiosHeaders';
1872
1894
  }
@@ -2860,7 +2882,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2860
2882
  credentials: isCredentialsSupported ? withCredentials : undefined
2861
2883
  });
2862
2884
 
2863
- let response = await fetch(request);
2885
+ let response = await fetch(request, fetchOptions);
2864
2886
 
2865
2887
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2866
2888
 
@@ -2906,7 +2928,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2906
2928
  } catch (err) {
2907
2929
  unsubscribe && unsubscribe();
2908
2930
 
2909
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2931
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2910
2932
  throw Object.assign(
2911
2933
  new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
2912
2934
  {
@@ -3066,7 +3088,7 @@ function dispatchRequest(config) {
3066
3088
  });
3067
3089
  }
3068
3090
 
3069
- const VERSION$1 = "1.8.4";
3091
+ const VERSION$1 = "1.10.0";
3070
3092
 
3071
3093
  const validators$1 = {};
3072
3094
 
@@ -3174,7 +3196,7 @@ const validators = validator.validators;
3174
3196
  */
3175
3197
  class Axios$1 {
3176
3198
  constructor(instanceConfig) {
3177
- this.defaults = instanceConfig;
3199
+ this.defaults = instanceConfig || {};
3178
3200
  this.interceptors = {
3179
3201
  request: new InterceptorManager$1(),
3180
3202
  response: new InterceptorManager$1()