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.
@@ -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
  'use strict';
3
3
 
4
4
  function bind(fn, thisArg) {
@@ -11,6 +11,7 @@ function bind(fn, thisArg) {
11
11
 
12
12
  const {toString} = Object.prototype;
13
13
  const {getPrototypeOf} = Object;
14
+ const {iterator, toStringTag} = Symbol;
14
15
 
15
16
  const kindOf = (cache => thing => {
16
17
  const str = toString.call(thing);
@@ -137,7 +138,7 @@ const isPlainObject = (val) => {
137
138
  }
138
139
 
139
140
  const prototype = getPrototypeOf(val);
140
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
141
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
141
142
  };
142
143
 
143
144
  /**
@@ -488,13 +489,13 @@ const isTypedArray = (TypedArray => {
488
489
  * @returns {void}
489
490
  */
490
491
  const forEachEntry = (obj, fn) => {
491
- const generator = obj && obj[Symbol.iterator];
492
+ const generator = obj && obj[iterator];
492
493
 
493
- const iterator = generator.call(obj);
494
+ const _iterator = generator.call(obj);
494
495
 
495
496
  let result;
496
497
 
497
- while ((result = iterator.next()) && !result.done) {
498
+ while ((result = _iterator.next()) && !result.done) {
498
499
  const pair = result.value;
499
500
  fn.call(obj, pair[0], pair[1]);
500
501
  }
@@ -615,7 +616,7 @@ const toFiniteNumber = (value, defaultValue) => {
615
616
  * @returns {boolean}
616
617
  */
617
618
  function isSpecCompliantForm(thing) {
618
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
619
+ return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
619
620
  }
620
621
 
621
622
  const toJSONObject = (obj) => {
@@ -684,6 +685,10 @@ const asap = typeof queueMicrotask !== 'undefined' ?
684
685
 
685
686
  // *********************
686
687
 
688
+
689
+ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
690
+
691
+
687
692
  var utils$1 = {
688
693
  isArray,
689
694
  isArrayBuffer,
@@ -739,7 +744,8 @@ var utils$1 = {
739
744
  isAsyncFn,
740
745
  isThenable,
741
746
  setImmediate: _setImmediate,
742
- asap
747
+ asap,
748
+ isIterable
743
749
  };
744
750
 
745
751
  /**
@@ -1724,10 +1730,18 @@ class AxiosHeaders {
1724
1730
  setHeaders(header, valueOrRewrite);
1725
1731
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1726
1732
  setHeaders(parseHeaders(header), valueOrRewrite);
1727
- } else if (utils$1.isHeaders(header)) {
1728
- for (const [key, value] of header.entries()) {
1729
- setHeader(value, key, rewrite);
1733
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1734
+ let obj = {}, dest, key;
1735
+ for (const entry of header) {
1736
+ if (!utils$1.isArray(entry)) {
1737
+ throw TypeError('Object iterator must return a key-value pair');
1738
+ }
1739
+
1740
+ obj[key = entry[0]] = (dest = obj[key]) ?
1741
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1730
1742
  }
1743
+
1744
+ setHeaders(obj, valueOrRewrite);
1731
1745
  } else {
1732
1746
  header != null && setHeader(valueOrRewrite, header, rewrite);
1733
1747
  }
@@ -1869,6 +1883,10 @@ class AxiosHeaders {
1869
1883
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1870
1884
  }
1871
1885
 
1886
+ getSetCookie() {
1887
+ return this.get("set-cookie") || [];
1888
+ }
1889
+
1872
1890
  get [Symbol.toStringTag]() {
1873
1891
  return 'AxiosHeaders';
1874
1892
  }
@@ -2908,7 +2926,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2908
2926
  } catch (err) {
2909
2927
  unsubscribe && unsubscribe();
2910
2928
 
2911
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2929
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2912
2930
  throw Object.assign(
2913
2931
  new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2914
2932
  {
@@ -3068,7 +3086,7 @@ function dispatchRequest(config) {
3068
3086
  });
3069
3087
  }
3070
3088
 
3071
- const VERSION = "1.8.4";
3089
+ const VERSION = "1.9.0";
3072
3090
 
3073
3091
  const validators$1 = {};
3074
3092
 
@@ -3176,7 +3194,7 @@ const validators = validator.validators;
3176
3194
  */
3177
3195
  class Axios {
3178
3196
  constructor(instanceConfig) {
3179
- this.defaults = instanceConfig;
3197
+ this.defaults = instanceConfig || {};
3180
3198
  this.interceptors = {
3181
3199
  request: new InterceptorManager$1(),
3182
3200
  response: new InterceptorManager$1()