axios 1.3.5 → 1.4.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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- // Axios v1.3.5 Copyright (c) 2023 Matt Zabriskie and contributors
1
+ // Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
2
2
  'use strict';
3
3
 
4
4
  function bind(fn, thisArg) {
@@ -193,12 +193,16 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
193
193
  * @returns {boolean} True if value is an FormData, otherwise false
194
194
  */
195
195
  const isFormData = (thing) => {
196
- const pattern = '[object FormData]';
196
+ let kind;
197
197
  return thing && (
198
- (typeof FormData === 'function' && thing instanceof FormData) ||
199
- toString.call(thing) === pattern ||
200
- (isFunction(thing.toString) && thing.toString() === pattern)
201
- );
198
+ (typeof FormData === 'function' && thing instanceof FormData) || (
199
+ isFunction(thing.append) && (
200
+ (kind = kindOf(thing)) === 'formdata' ||
201
+ // detect form-data instance
202
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
203
+ )
204
+ )
205
+ )
202
206
  };
203
207
 
204
208
  /**
@@ -663,6 +667,11 @@ const toJSONObject = (obj) => {
663
667
  return visit(obj, 0);
664
668
  };
665
669
 
670
+ const isAsyncFn = kindOfTest('AsyncFunction');
671
+
672
+ const isThenable = (thing) =>
673
+ thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
674
+
666
675
  var utils = {
667
676
  isArray,
668
677
  isArrayBuffer,
@@ -712,7 +721,9 @@ var utils = {
712
721
  ALPHABET,
713
722
  generateString,
714
723
  isSpecCompliantForm,
715
- toJSONObject
724
+ toJSONObject,
725
+ isAsyncFn,
726
+ isThenable
716
727
  };
717
728
 
718
729
  /**
@@ -2200,8 +2211,12 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
2200
2211
  }
2201
2212
  }
2202
2213
 
2203
- if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
2204
- requestHeaders.setContentType(false); // Let the browser set it
2214
+ if (utils.isFormData(requestData)) {
2215
+ if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
2216
+ requestHeaders.setContentType(false); // Let the browser set it
2217
+ } else {
2218
+ requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
2219
+ }
2205
2220
  }
2206
2221
 
2207
2222
  let request = new XMLHttpRequest();
@@ -2607,7 +2622,7 @@ function mergeConfig(config1, config2) {
2607
2622
  headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2608
2623
  };
2609
2624
 
2610
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2625
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2611
2626
  const merge = mergeMap[prop] || mergeDeepProperties;
2612
2627
  const configValue = merge(config1[prop], config2[prop], prop);
2613
2628
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -2616,7 +2631,7 @@ function mergeConfig(config1, config2) {
2616
2631
  return config;
2617
2632
  }
2618
2633
 
2619
- const VERSION = "1.3.5";
2634
+ const VERSION = "1.4.0";
2620
2635
 
2621
2636
  const validators$1 = {};
2622
2637