axios 1.3.4 → 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.

package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ # [1.4.0](https://github.com/axios/axios/compare/v1.3.6...v1.4.0) (2023-04-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **formdata:** add `multipart/form-data` content type for FormData payload on custom client environments; ([#5678](https://github.com/axios/axios/issues/5678)) ([bbb61e7](https://github.com/axios/axios/commit/bbb61e70cb1185adfb1cbbb86eaf6652c48d89d1))
9
+ * **package:** export package internals with unsafe path prefix; ([#5677](https://github.com/axios/axios/issues/5677)) ([df38c94](https://github.com/axios/axios/commit/df38c949f26414d88ba29ec1e353c4d4f97eaf09))
10
+
11
+
12
+ ### Features
13
+
14
+ * **dns:** added support for a custom lookup function; ([#5339](https://github.com/axios/axios/issues/5339)) ([2701911](https://github.com/axios/axios/commit/2701911260a1faa5cc5e1afe437121b330a3b7bb))
15
+ * **types:** export `AxiosHeaderValue` type. ([#5525](https://github.com/axios/axios/issues/5525)) ([726f1c8](https://github.com/axios/axios/commit/726f1c8e00cffa0461a8813a9bdcb8f8b9d762cf))
16
+
17
+
18
+ ### Performance Improvements
19
+
20
+ * **merge-config:** optimize mergeConfig performance by avoiding duplicate key visits; ([#5679](https://github.com/axios/axios/issues/5679)) ([e6f7053](https://github.com/axios/axios/commit/e6f7053bf1a3e87cf1f9da8677e12e3fe829d68e))
21
+
22
+ ### Contributors to this release
23
+
24
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+151/-16 (#5684 #5339 #5679 #5678 #5677 )")
25
+ - <img src="https://avatars.githubusercontent.com/u/47537704?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )")
26
+ - <img src="https://avatars.githubusercontent.com/u/43876655?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )")
27
+
28
+ ## [1.3.6](https://github.com/axios/axios/compare/v1.3.5...v1.3.6) (2023-04-19)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **types:** added transport to RawAxiosRequestConfig ([#5445](https://github.com/axios/axios/issues/5445)) ([6f360a2](https://github.com/axios/axios/commit/6f360a2531d8d70363fd9becef6a45a323f170e2))
34
+ * **utils:** make isFormData detection logic stricter to avoid unnecessary calling of the `toString` method on the target; ([#5661](https://github.com/axios/axios/issues/5661)) ([aa372f7](https://github.com/axios/axios/commit/aa372f7306295dfd1100c1c2c77ce95c95808e76))
35
+
36
+ ### Contributors to this release
37
+
38
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+48/-10 (#5665 #5661 #5663 )")
39
+ - <img src="https://avatars.githubusercontent.com/u/5492927?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )")
40
+
41
+ ## [1.3.5](https://github.com/axios/axios/compare/v1.3.4...v1.3.5) (2023-04-05)
42
+
43
+
44
+ ### Bug Fixes
45
+
46
+ * **headers:** fixed isValidHeaderName to support full list of allowed characters; ([#5584](https://github.com/axios/axios/issues/5584)) ([e7decef](https://github.com/axios/axios/commit/e7decef6a99f4627e27ed9ea5b00ce8e201c3841))
47
+ * **params:** re-added the ability to set the function as `paramsSerializer` config; ([#5633](https://github.com/axios/axios/issues/5633)) ([a56c866](https://github.com/axios/axios/commit/a56c8661209d5ce5a645a05f294a0e08a6c1f6b3))
48
+
49
+ ### Contributors to this release
50
+
51
+ - <img src="https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+28/-10 (#5633 #5584 )")
52
+
3
53
  ## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22)
4
54
 
5
55
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.3.4 Copyright (c) 2023 Matt Zabriskie and contributors
1
+ // Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -283,8 +283,10 @@
283
283
  * @returns {boolean} True if value is an FormData, otherwise false
284
284
  */
285
285
  var isFormData = function isFormData(thing) {
286
- var pattern = '[object FormData]';
287
- return thing && (typeof FormData === 'function' && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
286
+ var kind;
287
+ return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
288
+ // detect form-data instance
289
+ kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]'));
288
290
  };
289
291
 
290
292
  /**
@@ -720,6 +722,10 @@
720
722
  };
721
723
  return visit(obj, 0);
722
724
  };
725
+ var isAsyncFn = kindOfTest('AsyncFunction');
726
+ var isThenable = function isThenable(thing) {
727
+ return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
728
+ };
723
729
  var utils = {
724
730
  isArray: isArray,
725
731
  isArrayBuffer: isArrayBuffer,
@@ -770,7 +776,9 @@
770
776
  ALPHABET: ALPHABET,
771
777
  generateString: generateString,
772
778
  isSpecCompliantForm: isSpecCompliantForm,
773
- toJSONObject: toJSONObject
779
+ toJSONObject: toJSONObject,
780
+ isAsyncFn: isAsyncFn,
781
+ isThenable: isThenable
774
782
  };
775
783
 
776
784
  /**
@@ -1537,9 +1545,9 @@
1537
1545
  }
1538
1546
  return tokens;
1539
1547
  }
1540
- function isValidHeaderName(str) {
1541
- return /^[-_a-zA-Z]+$/.test(str.trim());
1542
- }
1548
+ var isValidHeaderName = function isValidHeaderName(str) {
1549
+ return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1550
+ };
1543
1551
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1544
1552
  if (utils.isFunction(filter)) {
1545
1553
  return filter.call(this, value, header);
@@ -2059,8 +2067,12 @@
2059
2067
  config.signal.removeEventListener('abort', onCanceled);
2060
2068
  }
2061
2069
  }
2062
- if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
2063
- requestHeaders.setContentType(false); // Let the browser set it
2070
+ if (utils.isFormData(requestData)) {
2071
+ if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
2072
+ requestHeaders.setContentType(false); // Let the browser set it
2073
+ } else {
2074
+ requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
2075
+ }
2064
2076
  }
2065
2077
 
2066
2078
  var request = new XMLHttpRequest();
@@ -2420,7 +2432,7 @@
2420
2432
  return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2421
2433
  }
2422
2434
  };
2423
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2435
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2424
2436
  var merge = mergeMap[prop] || mergeDeepProperties;
2425
2437
  var configValue = merge(config1[prop], config2[prop], prop);
2426
2438
  utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
@@ -2428,7 +2440,7 @@
2428
2440
  return config;
2429
2441
  }
2430
2442
 
2431
- var VERSION = "1.3.4";
2443
+ var VERSION = "1.4.0";
2432
2444
 
2433
2445
  var validators$1 = {};
2434
2446
 
@@ -2555,11 +2567,17 @@
2555
2567
  clarifyTimeoutError: validators.transitional(validators["boolean"])
2556
2568
  }, false);
2557
2569
  }
2558
- if (paramsSerializer !== undefined) {
2559
- validator.assertOptions(paramsSerializer, {
2560
- encode: validators["function"],
2561
- serialize: validators["function"]
2562
- }, true);
2570
+ if (paramsSerializer != null) {
2571
+ if (utils.isFunction(paramsSerializer)) {
2572
+ config.paramsSerializer = {
2573
+ serialize: paramsSerializer
2574
+ };
2575
+ } else {
2576
+ validator.assertOptions(paramsSerializer, {
2577
+ encode: validators["function"],
2578
+ serialize: validators["function"]
2579
+ }, true);
2580
+ }
2563
2581
  }
2564
2582
 
2565
2583
  // Set config.method