axios 1.8.4 → 1.9.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.9.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
  /**
@@ -1722,10 +1728,18 @@ class AxiosHeaders$1 {
1722
1728
  setHeaders(header, valueOrRewrite);
1723
1729
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1724
1730
  setHeaders(parseHeaders(header), valueOrRewrite);
1725
- } else if (utils$1.isHeaders(header)) {
1726
- for (const [key, value] of header.entries()) {
1727
- setHeader(value, key, rewrite);
1731
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1732
+ let obj = {}, dest, key;
1733
+ for (const entry of header) {
1734
+ if (!utils$1.isArray(entry)) {
1735
+ throw TypeError('Object iterator must return a key-value pair');
1736
+ }
1737
+
1738
+ obj[key = entry[0]] = (dest = obj[key]) ?
1739
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1728
1740
  }
1741
+
1742
+ setHeaders(obj, valueOrRewrite);
1729
1743
  } else {
1730
1744
  header != null && setHeader(valueOrRewrite, header, rewrite);
1731
1745
  }
@@ -1867,6 +1881,10 @@ class AxiosHeaders$1 {
1867
1881
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1868
1882
  }
1869
1883
 
1884
+ getSetCookie() {
1885
+ return this.get("set-cookie") || [];
1886
+ }
1887
+
1870
1888
  get [Symbol.toStringTag]() {
1871
1889
  return 'AxiosHeaders';
1872
1890
  }
@@ -2906,7 +2924,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
2906
2924
  } catch (err) {
2907
2925
  unsubscribe && unsubscribe();
2908
2926
 
2909
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2927
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2910
2928
  throw Object.assign(
2911
2929
  new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
2912
2930
  {
@@ -3066,7 +3084,7 @@ function dispatchRequest(config) {
3066
3084
  });
3067
3085
  }
3068
3086
 
3069
- const VERSION$1 = "1.8.4";
3087
+ const VERSION$1 = "1.9.0";
3070
3088
 
3071
3089
  const validators$1 = {};
3072
3090
 
@@ -3174,7 +3192,7 @@ const validators = validator.validators;
3174
3192
  */
3175
3193
  class Axios$1 {
3176
3194
  constructor(instanceConfig) {
3177
- this.defaults = instanceConfig;
3195
+ this.defaults = instanceConfig || {};
3178
3196
  this.interceptors = {
3179
3197
  request: new InterceptorManager$1(),
3180
3198
  response: new InterceptorManager$1()