axios 1.2.5 → 1.3.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,35 @@
1
1
  # Changelog
2
2
 
3
+ # [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **headers:** fixed & optimized clear method; ([#5507](https://github.com/axios/axios/issues/5507)) ([9915635](https://github.com/axios/axios/commit/9915635c69d0ab70daca5738488421f67ca60959))
9
+ * **http:** add zlib headers if missing ([#5497](https://github.com/axios/axios/issues/5497)) ([65e8d1e](https://github.com/axios/axios/commit/65e8d1e28ce829f47a837e45129730e541950d3c))
10
+
11
+
12
+ ### Features
13
+
14
+ * **fomdata:** added support for spec-compliant FormData & Blob types; ([#5316](https://github.com/axios/axios/issues/5316)) ([6ac574e](https://github.com/axios/axios/commit/6ac574e00a06731288347acea1e8246091196953))
15
+
16
+ ### Contributors to this release
17
+
18
+ - <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 "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )")
19
+ - <img src="https://avatars.githubusercontent.com/u/35015993?v&#x3D;4&amp;s&#x3D;18" alt="avatar" width="18"/> [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )")
20
+
21
+ ## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **headers:** added missed Authorization accessor; ([#5502](https://github.com/axios/axios/issues/5502)) ([342c0ba](https://github.com/axios/axios/commit/342c0ba9a16ea50f5ed7d2366c5c1a2c877e3f26))
27
+ * **types:** fixed `CommonRequestHeadersList` & `CommonResponseHeadersList` types to be private in commonJS; ([#5503](https://github.com/axios/axios/issues/5503)) ([5a3d0a3](https://github.com/axios/axios/commit/5a3d0a3234d77361a1bc7cedee2da1e11df08e2c))
28
+
29
+ ### Contributors to this release
30
+
31
+ - ![avatar](https://avatars.githubusercontent.com/u/12586868?v&#x3D;4&amp;s&#x3D;16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )")
32
+
3
33
  ## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26)
4
34
 
5
35
 
package/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.2.5 Copyright (c) 2023 Matt Zabriskie and contributors
1
+ // Axios v1.3.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) :
@@ -598,7 +598,7 @@
598
598
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
599
599
  var isHTMLForm = kindOfTest('HTMLFormElement');
600
600
  var toCamelCase = function toCamelCase(str) {
601
- return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
601
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
602
602
  return p1.toUpperCase() + p2;
603
603
  });
604
604
  };
@@ -670,6 +670,34 @@
670
670
  value = +value;
671
671
  return Number.isFinite(value) ? value : defaultValue;
672
672
  };
673
+ var ALPHA = 'abcdefghijklmnopqrstuvwxyz';
674
+ var DIGIT = '0123456789';
675
+ var ALPHABET = {
676
+ DIGIT: DIGIT,
677
+ ALPHA: ALPHA,
678
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
679
+ };
680
+ var generateString = function generateString() {
681
+ var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16;
682
+ var alphabet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALPHABET.ALPHA_DIGIT;
683
+ var str = '';
684
+ var length = alphabet.length;
685
+ while (size--) {
686
+ str += alphabet[Math.random() * length | 0];
687
+ }
688
+ return str;
689
+ };
690
+
691
+ /**
692
+ * If the thing is a FormData object, return true, otherwise return false.
693
+ *
694
+ * @param {unknown} thing - The thing to check.
695
+ *
696
+ * @returns {boolean}
697
+ */
698
+ function isSpecCompliantForm(thing) {
699
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
700
+ }
673
701
  var toJSONObject = function toJSONObject(obj) {
674
702
  var stack = new Array(10);
675
703
  var visit = function visit(source, i) {
@@ -739,6 +767,9 @@
739
767
  findKey: findKey,
740
768
  global: _global,
741
769
  isContextDefined: isContextDefined,
770
+ ALPHABET: ALPHABET,
771
+ generateString: generateString,
772
+ isSpecCompliantForm: isSpecCompliantForm,
742
773
  toJSONObject: toJSONObject
743
774
  };
744
775
 
@@ -817,9 +848,8 @@
817
848
  return axiosError;
818
849
  };
819
850
 
820
- /* eslint-env browser */
821
- var browser = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData;
822
- var FormData$2 = browser;
851
+ // eslint-disable-next-line strict
852
+ var httpAdapter = null;
823
853
 
824
854
  /**
825
855
  * Determines if the given thing is a array or js object.
@@ -875,17 +905,6 @@
875
905
  return /^is[A-Z]/.test(prop);
876
906
  });
877
907
 
878
- /**
879
- * If the thing is a FormData object, return true, otherwise return false.
880
- *
881
- * @param {unknown} thing - The thing to check.
882
- *
883
- * @returns {boolean}
884
- */
885
- function isSpecCompliant(thing) {
886
- return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
887
- }
888
-
889
908
  /**
890
909
  * Convert a data object to FormData
891
910
  *
@@ -915,7 +934,7 @@
915
934
  }
916
935
 
917
936
  // eslint-disable-next-line no-param-reassign
918
- formData = formData || new (FormData$2 || FormData)();
937
+ formData = formData || new (FormData)();
919
938
 
920
939
  // eslint-disable-next-line no-param-reassign
921
940
  options = utils.toFlatObject(options, {
@@ -932,7 +951,7 @@
932
951
  var dots = options.dots;
933
952
  var indexes = options.indexes;
934
953
  var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
935
- var useBlob = _Blob && isSpecCompliant(formData);
954
+ var useBlob = _Blob && utils.isSpecCompliantForm(formData);
936
955
  if (!utils.isFunction(visitor)) {
937
956
  throw new TypeError('visitor must be a function');
938
957
  }
@@ -1638,8 +1657,18 @@
1638
1657
  }
1639
1658
  }, {
1640
1659
  key: "clear",
1641
- value: function clear() {
1642
- return Object.keys(this).forEach(this["delete"].bind(this));
1660
+ value: function clear(matcher) {
1661
+ var keys = Object.keys(this);
1662
+ var i = keys.length;
1663
+ var deleted = false;
1664
+ while (i--) {
1665
+ var key = keys[i];
1666
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher)) {
1667
+ delete this[key];
1668
+ deleted = true;
1669
+ }
1670
+ }
1671
+ return deleted;
1643
1672
  }
1644
1673
  }, {
1645
1674
  key: "normalize",
@@ -1738,7 +1767,7 @@
1738
1767
  }]);
1739
1768
  return AxiosHeaders;
1740
1769
  }(Symbol.iterator, Symbol.toStringTag);
1741
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
1770
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1742
1771
  utils.freezeMethods(AxiosHeaders.prototype);
1743
1772
  utils.freezeMethods(AxiosHeaders);
1744
1773
  var AxiosHeaders$1 = AxiosHeaders;
@@ -1785,9 +1814,6 @@
1785
1814
  __CANCEL__: true
1786
1815
  });
1787
1816
 
1788
- // eslint-disable-next-line strict
1789
- var httpAdapter = null;
1790
-
1791
1817
  /**
1792
1818
  * Resolve or reject a Promise based on response status.
1793
1819
  *
@@ -2397,7 +2423,7 @@
2397
2423
  return config;
2398
2424
  }
2399
2425
 
2400
- var VERSION = "1.2.5";
2426
+ var VERSION = "1.3.0";
2401
2427
 
2402
2428
  var validators$1 = {};
2403
2429