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
  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) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
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[Symbol.iterator];
517
+ const generator = obj && obj[iterator];
517
518
 
518
- const iterator = generator.call(obj);
519
+ const _iterator = generator.call(obj);
519
520
 
520
521
  let result;
521
522
 
522
- while ((result = iterator.next()) && !result.done) {
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[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
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
  /**
@@ -1767,10 +1773,18 @@ class AxiosHeaders {
1767
1773
  setHeaders(header, valueOrRewrite);
1768
1774
  } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1769
1775
  setHeaders(parseHeaders(header), valueOrRewrite);
1770
- } else if (utils$1.isHeaders(header)) {
1771
- for (const [key, value] of header.entries()) {
1772
- setHeader(value, key, rewrite);
1776
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1777
+ let obj = {}, dest, key;
1778
+ for (const entry of header) {
1779
+ if (!utils$1.isArray(entry)) {
1780
+ throw TypeError('Object iterator must return a key-value pair');
1781
+ }
1782
+
1783
+ obj[key = entry[0]] = (dest = obj[key]) ?
1784
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
1773
1785
  }
1786
+
1787
+ setHeaders(obj, valueOrRewrite);
1774
1788
  } else {
1775
1789
  header != null && setHeader(valueOrRewrite, header, rewrite);
1776
1790
  }
@@ -1912,6 +1926,10 @@ class AxiosHeaders {
1912
1926
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1913
1927
  }
1914
1928
 
1929
+ getSetCookie() {
1930
+ return this.get("set-cookie") || [];
1931
+ }
1932
+
1915
1933
  get [Symbol.toStringTag]() {
1916
1934
  return 'AxiosHeaders';
1917
1935
  }
@@ -2084,7 +2102,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2084
2102
  return requestedURL;
2085
2103
  }
2086
2104
 
2087
- const VERSION = "1.8.4";
2105
+ const VERSION = "1.9.0";
2088
2106
 
2089
2107
  function parseProtocol(url) {
2090
2108
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -2366,7 +2384,7 @@ const formDataToStream = (form, headersHandler, options) => {
2366
2384
  }
2367
2385
 
2368
2386
  const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2369
- const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
2387
+ const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
2370
2388
  let contentLength = footerBytes.byteLength;
2371
2389
 
2372
2390
  const parts = Array.from(form.entries()).map(([name, value]) => {
@@ -3967,7 +3985,7 @@ const fetchAdapter = isFetchSupported && (async (config) => {
3967
3985
  } catch (err) {
3968
3986
  unsubscribe && unsubscribe();
3969
3987
 
3970
- if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
3988
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3971
3989
  throw Object.assign(
3972
3990
  new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
3973
3991
  {
@@ -4233,7 +4251,7 @@ const validators = validator.validators;
4233
4251
  */
4234
4252
  class Axios {
4235
4253
  constructor(instanceConfig) {
4236
- this.defaults = instanceConfig;
4254
+ this.defaults = instanceConfig || {};
4237
4255
  this.interceptors = {
4238
4256
  request: new InterceptorManager$1(),
4239
4257
  response: new InterceptorManager$1()