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.
@@ -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
  '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
  /**
@@ -958,6 +964,10 @@ function toFormData(obj, formData, options) {
958
964
  return value.toISOString();
959
965
  }
960
966
 
967
+ if (utils$1.isBoolean(value)) {
968
+ return value.toString();
969
+ }
970
+
961
971
  if (!useBlob && utils$1.isBlob(value)) {
962
972
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
963
973
  }
@@ -1724,10 +1734,18 @@ class AxiosHeaders {
1724
1734
  setHeaders(header, valueOrRewrite);
1725
1735
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1726
1736
  setHeaders(parseHeaders(header), valueOrRewrite);
1727
- } else if (utils$1.isHeaders(header)) {
1728
- for (const [key, value] of header.entries()) {
1729
- setHeader(value, key, rewrite);
1737
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1738
+ let obj = {}, dest, key;
1739
+ for (const entry of header) {
1740
+ if (!utils$1.isArray(entry)) {
1741
+ throw TypeError('Object iterator must return a key-value pair');
1742
+ }
1743
+
1744
+ obj[key = entry[0]] = (dest = obj[key]) ?
1745
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1730
1746
  }
1747
+
1748
+ setHeaders(obj, valueOrRewrite);
1731
1749
  } else {
1732
1750
  header != null && setHeader(valueOrRewrite, header, rewrite);
1733
1751
  }
@@ -1869,6 +1887,10 @@ class AxiosHeaders {
1869
1887
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1870
1888
  }
1871
1889
 
1890
+ getSetCookie() {
1891
+ return this.get("set-cookie") || [];
1892
+ }
1893
+
1872
1894
  get [Symbol.toStringTag]() {
1873
1895
  return 'AxiosHeaders';
1874
1896
  }
@@ -2862,7 +2884,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2862
2884
  credentials: isCredentialsSupported ? withCredentials : undefined
2863
2885
  });
2864
2886
 
2865
- let response = await fetch(request);
2887
+ let response = await fetch(request, fetchOptions);
2866
2888
 
2867
2889
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2868
2890
 
@@ -2908,7 +2930,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
2908
2930
  } catch (err) {
2909
2931
  unsubscribe && unsubscribe();
2910
2932
 
2911
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2933
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
2912
2934
  throw Object.assign(
2913
2935
  new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2914
2936
  {
@@ -3068,7 +3090,7 @@ function dispatchRequest(config) {
3068
3090
  });
3069
3091
  }
3070
3092
 
3071
- const VERSION = "1.8.4";
3093
+ const VERSION = "1.10.0";
3072
3094
 
3073
3095
  const validators$1 = {};
3074
3096
 
@@ -3176,7 +3198,7 @@ const validators = validator.validators;
3176
3198
  */
3177
3199
  class Axios {
3178
3200
  constructor(instanceConfig) {
3179
- this.defaults = instanceConfig;
3201
+ this.defaults = instanceConfig || {};
3180
3202
  this.interceptors = {
3181
3203
  request: new InterceptorManager$1(),
3182
3204
  response: new InterceptorManager$1()