axios 0.21.4 → 0.22.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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.22.0 (October 01, 2021)
4
+
5
+ Fixes and Functionality:
6
+ - Caseless header comparing in HTTP adapter ([#2880](https://github.com/axios/axios/pull/2880))
7
+ - Avoid package.json import fixing issues and warnings related to this ([#4041](https://github.com/axios/axios/pull/4041)), ([#4065](https://github.com/axios/axios/pull/4065))
8
+ - Fixed cancelToken leakage and added AbortController support ([#3305](https://github.com/axios/axios/pull/3305))
9
+ - Updating CI to run on release branches
10
+ - Bump follow redirects version
11
+ - Fixed default transitional config for custom Axios instance; ([#4052](https://github.com/axios/axios/pull/4052))
12
+
13
+ Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
14
+
15
+ - [Jay](mailto:jasonsaayman@gmail.com)
16
+ - [Matt R. Wilson](https://github.com/mastermatt)
17
+ - [Xianming Zhong](https://github.com/chinesedfan)
18
+ - [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS)
19
+
3
20
  ### 0.21.4 (September 6, 2021)
4
21
 
5
22
  Fixes and Functionality:
6
- - Fixing JSON transform when data is stringified. Providing backward compatibility and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))
23
+ - Fixing JSON transform when data is stringified. Providing backward compatability and complying to the JSON RFC standard ([#4020](https://github.com/axios/axios/pull/4020))
7
24
 
8
25
  Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:
9
26
 
package/README.md CHANGED
@@ -452,11 +452,22 @@ These are the available config options for making requests. Only the `url` is re
452
452
  cancelToken: new CancelToken(function (cancel) {
453
453
  }),
454
454
 
455
+ // an alternative way to cancel Axios requests using AbortController
456
+ signal: new AbortController().signal,
457
+
455
458
  // `decompress` indicates whether or not the response body should be decompressed
456
459
  // automatically. If set to `true` will also remove the 'content-encoding' header
457
460
  // from the responses objects of all decompressed responses
458
461
  // - Node only (XHR cannot turn off decompression)
459
- decompress: true, // default
462
+ decompress: true // default
463
+
464
+ // `insecureHTTPParser` boolean.
465
+ // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
466
+ // This may allow interoperability with non-conformant HTTP implementations.
467
+ // Using the insecure parser should be avoided.
468
+ // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
469
+ // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
470
+ insecureHTTPParser: undefined // default
460
471
 
461
472
  // transitional options for backward compatibility that may be removed in the newer versions
462
473
  transitional: {
@@ -726,7 +737,20 @@ axios.get('/user/12345', {
726
737
  cancel();
727
738
  ```
728
739
 
729
- > Note: you can cancel several requests with the same cancel token.
740
+ Axios supports AbortController to abort requests in [`fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#aborting_a_fetch) way:
741
+ ```js
742
+ const controller = new AbortController();
743
+
744
+ axios.get('/foo/bar', {
745
+ signal: controller.signal
746
+ }).then(function(response) {
747
+ //...
748
+ });
749
+ // cancel the request
750
+ controller.abort()
751
+ ```
752
+
753
+ > Note: you can cancel several requests with the same cancel token/abort controller.
730
754
  > If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make real request.
731
755
 
732
756
  ## Using application/x-www-form-urlencoded format
package/dist/axios.js CHANGED
@@ -1,4 +1,3 @@
1
- /* axios v0.21.4 | (c) 2021 by Matt Zabriskie */
2
1
  (function webpackUniversalModuleDefinition(root, factory) {
3
2
  if(typeof exports === 'object' && typeof module === 'object')
4
3
  module.exports = factory();
@@ -126,12 +125,24 @@ var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./lib/core
126
125
  var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./lib/helpers/parseHeaders.js");
127
126
  var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./lib/helpers/isURLSameOrigin.js");
128
127
  var createError = __webpack_require__(/*! ../core/createError */ "./lib/core/createError.js");
128
+ var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults.js");
129
+ var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "./lib/cancel/Cancel.js");
129
130
 
130
131
  module.exports = function xhrAdapter(config) {
131
132
  return new Promise(function dispatchXhrRequest(resolve, reject) {
132
133
  var requestData = config.data;
133
134
  var requestHeaders = config.headers;
134
135
  var responseType = config.responseType;
136
+ var onCanceled;
137
+ function done() {
138
+ if (config.cancelToken) {
139
+ config.cancelToken.unsubscribe(onCanceled);
140
+ }
141
+
142
+ if (config.signal) {
143
+ config.signal.removeEventListener('abort', onCanceled);
144
+ }
145
+ }
135
146
 
136
147
  if (utils.isFormData(requestData)) {
137
148
  delete requestHeaders['Content-Type']; // Let the browser set it
@@ -169,7 +180,13 @@ module.exports = function xhrAdapter(config) {
169
180
  request: request
170
181
  };
171
182
 
172
- settle(resolve, reject, response);
183
+ settle(function _resolve(value) {
184
+ resolve(value);
185
+ done();
186
+ }, function _reject(err) {
187
+ reject(err);
188
+ done();
189
+ }, response);
173
190
 
174
191
  // Clean up request
175
192
  request = null;
@@ -223,13 +240,14 @@ module.exports = function xhrAdapter(config) {
223
240
  // Handle timeout
224
241
  request.ontimeout = function handleTimeout() {
225
242
  var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
243
+ var transitional = config.transitional || defaults.transitional;
226
244
  if (config.timeoutErrorMessage) {
227
245
  timeoutErrorMessage = config.timeoutErrorMessage;
228
246
  }
229
247
  reject(createError(
230
248
  timeoutErrorMessage,
231
249
  config,
232
- config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
250
+ transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
233
251
  request));
234
252
 
235
253
  // Clean up request
@@ -283,18 +301,22 @@ module.exports = function xhrAdapter(config) {
283
301
  request.upload.addEventListener('progress', config.onUploadProgress);
284
302
  }
285
303
 
286
- if (config.cancelToken) {
304
+ if (config.cancelToken || config.signal) {
287
305
  // Handle cancellation
288
- config.cancelToken.promise.then(function onCanceled(cancel) {
306
+ // eslint-disable-next-line func-names
307
+ onCanceled = function(cancel) {
289
308
  if (!request) {
290
309
  return;
291
310
  }
292
-
311
+ reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
293
312
  request.abort();
294
- reject(cancel);
295
- // Clean up request
296
313
  request = null;
297
- });
314
+ };
315
+
316
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
317
+ if (config.signal) {
318
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
319
+ }
298
320
  }
299
321
 
300
322
  if (!requestData) {
@@ -341,6 +363,11 @@ function createInstance(defaultConfig) {
341
363
  // Copy context to instance
342
364
  utils.extend(instance, context);
343
365
 
366
+ // Factory for creating new instances
367
+ instance.create = function create(instanceConfig) {
368
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
369
+ };
370
+
344
371
  return instance;
345
372
  }
346
373
 
@@ -350,15 +377,11 @@ var axios = createInstance(defaults);
350
377
  // Expose Axios class to allow class inheritance
351
378
  axios.Axios = Axios;
352
379
 
353
- // Factory for creating new instances
354
- axios.create = function create(instanceConfig) {
355
- return createInstance(mergeConfig(axios.defaults, instanceConfig));
356
- };
357
-
358
380
  // Expose Cancel & CancelToken
359
381
  axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./lib/cancel/Cancel.js");
360
382
  axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./lib/cancel/CancelToken.js");
361
383
  axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./lib/cancel/isCancel.js");
384
+ axios.VERSION = __webpack_require__(/*! ./env/data */ "./lib/env/data.js").version;
362
385
 
363
386
  // Expose all/spread
364
387
  axios.all = function all(promises) {
@@ -432,11 +455,42 @@ function CancelToken(executor) {
432
455
  }
433
456
 
434
457
  var resolvePromise;
458
+
435
459
  this.promise = new Promise(function promiseExecutor(resolve) {
436
460
  resolvePromise = resolve;
437
461
  });
438
462
 
439
463
  var token = this;
464
+
465
+ // eslint-disable-next-line func-names
466
+ this.promise.then(function(cancel) {
467
+ if (!token._listeners) return;
468
+
469
+ var i;
470
+ var l = token._listeners.length;
471
+
472
+ for (i = 0; i < l; i++) {
473
+ token._listeners[i](cancel);
474
+ }
475
+ token._listeners = null;
476
+ });
477
+
478
+ // eslint-disable-next-line func-names
479
+ this.promise.then = function(onfulfilled) {
480
+ var _resolve;
481
+ // eslint-disable-next-line func-names
482
+ var promise = new Promise(function(resolve) {
483
+ token.subscribe(resolve);
484
+ _resolve = resolve;
485
+ }).then(onfulfilled);
486
+
487
+ promise.cancel = function reject() {
488
+ token.unsubscribe(_resolve);
489
+ };
490
+
491
+ return promise;
492
+ };
493
+
440
494
  executor(function cancel(message) {
441
495
  if (token.reason) {
442
496
  // Cancellation has already been requested
@@ -457,6 +511,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
457
511
  }
458
512
  };
459
513
 
514
+ /**
515
+ * Subscribe to the cancel signal
516
+ */
517
+
518
+ CancelToken.prototype.subscribe = function subscribe(listener) {
519
+ if (this.reason) {
520
+ listener(this.reason);
521
+ return;
522
+ }
523
+
524
+ if (this._listeners) {
525
+ this._listeners.push(listener);
526
+ } else {
527
+ this._listeners = [listener];
528
+ }
529
+ };
530
+
531
+ /**
532
+ * Unsubscribe from the cancel signal
533
+ */
534
+
535
+ CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
536
+ if (!this._listeners) {
537
+ return;
538
+ }
539
+ var index = this._listeners.indexOf(listener);
540
+ if (index !== -1) {
541
+ this._listeners.splice(index, 1);
542
+ }
543
+ };
544
+
460
545
  /**
461
546
  * Returns an object that contains a new `CancelToken` and a function that, when called,
462
547
  * cancels the `CancelToken`.
@@ -555,9 +640,9 @@ Axios.prototype.request = function request(config) {
555
640
 
556
641
  if (transitional !== undefined) {
557
642
  validator.assertOptions(transitional, {
558
- silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
559
- forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
560
- clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')
643
+ silentJSONParsing: validators.transitional(validators.boolean),
644
+ forcedJSONParsing: validators.transitional(validators.boolean),
645
+ clarifyTimeoutError: validators.transitional(validators.boolean)
561
646
  }, false);
562
647
  }
563
648
 
@@ -796,6 +881,7 @@ var utils = __webpack_require__(/*! ./../utils */ "./lib/utils.js");
796
881
  var transformData = __webpack_require__(/*! ./transformData */ "./lib/core/transformData.js");
797
882
  var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./lib/cancel/isCancel.js");
798
883
  var defaults = __webpack_require__(/*! ../defaults */ "./lib/defaults.js");
884
+ var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "./lib/cancel/Cancel.js");
799
885
 
800
886
  /**
801
887
  * Throws a `Cancel` if cancellation has been requested.
@@ -804,6 +890,10 @@ function throwIfCancellationRequested(config) {
804
890
  if (config.cancelToken) {
805
891
  config.cancelToken.throwIfRequested();
806
892
  }
893
+
894
+ if (config.signal && config.signal.aborted) {
895
+ throw new Cancel('canceled');
896
+ }
807
897
  }
808
898
 
809
899
  /**
@@ -921,7 +1011,8 @@ module.exports = function enhanceError(error, config, code, request, response) {
921
1011
  stack: this.stack,
922
1012
  // Axios
923
1013
  config: this.config,
924
- code: this.code
1014
+ code: this.code,
1015
+ status: this.response && this.response.status ? this.response.status : null
925
1016
  };
926
1017
  };
927
1018
  return error;
@@ -955,17 +1046,6 @@ module.exports = function mergeConfig(config1, config2) {
955
1046
  config2 = config2 || {};
956
1047
  var config = {};
957
1048
 
958
- var valueFromConfig2Keys = ['url', 'method', 'data'];
959
- var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
960
- var defaultToConfig2Keys = [
961
- 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
962
- 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
963
- 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
964
- 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
965
- 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
966
- ];
967
- var directMergeKeys = ['validateStatus'];
968
-
969
1049
  function getMergedValue(target, source) {
970
1050
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
971
1051
  return utils.merge(target, source);
@@ -977,51 +1057,74 @@ module.exports = function mergeConfig(config1, config2) {
977
1057
  return source;
978
1058
  }
979
1059
 
1060
+ // eslint-disable-next-line consistent-return
980
1061
  function mergeDeepProperties(prop) {
981
1062
  if (!utils.isUndefined(config2[prop])) {
982
- config[prop] = getMergedValue(config1[prop], config2[prop]);
1063
+ return getMergedValue(config1[prop], config2[prop]);
983
1064
  } else if (!utils.isUndefined(config1[prop])) {
984
- config[prop] = getMergedValue(undefined, config1[prop]);
1065
+ return getMergedValue(undefined, config1[prop]);
985
1066
  }
986
1067
  }
987
1068
 
988
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
1069
+ // eslint-disable-next-line consistent-return
1070
+ function valueFromConfig2(prop) {
989
1071
  if (!utils.isUndefined(config2[prop])) {
990
- config[prop] = getMergedValue(undefined, config2[prop]);
1072
+ return getMergedValue(undefined, config2[prop]);
991
1073
  }
992
- });
993
-
994
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
1074
+ }
995
1075
 
996
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
1076
+ // eslint-disable-next-line consistent-return
1077
+ function defaultToConfig2(prop) {
997
1078
  if (!utils.isUndefined(config2[prop])) {
998
- config[prop] = getMergedValue(undefined, config2[prop]);
1079
+ return getMergedValue(undefined, config2[prop]);
999
1080
  } else if (!utils.isUndefined(config1[prop])) {
1000
- config[prop] = getMergedValue(undefined, config1[prop]);
1081
+ return getMergedValue(undefined, config1[prop]);
1001
1082
  }
1002
- });
1083
+ }
1003
1084
 
1004
- utils.forEach(directMergeKeys, function merge(prop) {
1085
+ // eslint-disable-next-line consistent-return
1086
+ function mergeDirectKeys(prop) {
1005
1087
  if (prop in config2) {
1006
- config[prop] = getMergedValue(config1[prop], config2[prop]);
1088
+ return getMergedValue(config1[prop], config2[prop]);
1007
1089
  } else if (prop in config1) {
1008
- config[prop] = getMergedValue(undefined, config1[prop]);
1090
+ return getMergedValue(undefined, config1[prop]);
1009
1091
  }
1010
- });
1011
-
1012
- var axiosKeys = valueFromConfig2Keys
1013
- .concat(mergeDeepPropertiesKeys)
1014
- .concat(defaultToConfig2Keys)
1015
- .concat(directMergeKeys);
1092
+ }
1016
1093
 
1017
- var otherKeys = Object
1018
- .keys(config1)
1019
- .concat(Object.keys(config2))
1020
- .filter(function filterAxiosKeys(key) {
1021
- return axiosKeys.indexOf(key) === -1;
1022
- });
1094
+ var mergeMap = {
1095
+ 'url': valueFromConfig2,
1096
+ 'method': valueFromConfig2,
1097
+ 'data': valueFromConfig2,
1098
+ 'baseURL': defaultToConfig2,
1099
+ 'transformRequest': defaultToConfig2,
1100
+ 'transformResponse': defaultToConfig2,
1101
+ 'paramsSerializer': defaultToConfig2,
1102
+ 'timeout': defaultToConfig2,
1103
+ 'timeoutMessage': defaultToConfig2,
1104
+ 'withCredentials': defaultToConfig2,
1105
+ 'adapter': defaultToConfig2,
1106
+ 'responseType': defaultToConfig2,
1107
+ 'xsrfCookieName': defaultToConfig2,
1108
+ 'xsrfHeaderName': defaultToConfig2,
1109
+ 'onUploadProgress': defaultToConfig2,
1110
+ 'onDownloadProgress': defaultToConfig2,
1111
+ 'decompress': defaultToConfig2,
1112
+ 'maxContentLength': defaultToConfig2,
1113
+ 'maxBodyLength': defaultToConfig2,
1114
+ 'transport': defaultToConfig2,
1115
+ 'httpAgent': defaultToConfig2,
1116
+ 'httpsAgent': defaultToConfig2,
1117
+ 'cancelToken': defaultToConfig2,
1118
+ 'socketPath': defaultToConfig2,
1119
+ 'responseEncoding': defaultToConfig2,
1120
+ 'validateStatus': mergeDirectKeys
1121
+ };
1023
1122
 
1024
- utils.forEach(otherKeys, mergeDeepProperties);
1123
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
1124
+ var merge = mergeMap[prop] || mergeDeepProperties;
1125
+ var configValue = merge(prop);
1126
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
1127
+ });
1025
1128
 
1026
1129
  return config;
1027
1130
  };
@@ -1189,7 +1292,7 @@ var defaults = {
1189
1292
  }],
1190
1293
 
1191
1294
  transformResponse: [function transformResponse(data) {
1192
- var transitional = this.transitional;
1295
+ var transitional = this.transitional || defaults.transitional;
1193
1296
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
1194
1297
  var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1195
1298
  var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
@@ -1224,12 +1327,12 @@ var defaults = {
1224
1327
 
1225
1328
  validateStatus: function validateStatus(status) {
1226
1329
  return status >= 200 && status < 300;
1227
- }
1228
- };
1330
+ },
1229
1331
 
1230
- defaults.headers = {
1231
- common: {
1232
- 'Accept': 'application/json, text/plain, */*'
1332
+ headers: {
1333
+ common: {
1334
+ 'Accept': 'application/json, text/plain, */*'
1335
+ }
1233
1336
  }
1234
1337
  };
1235
1338
 
@@ -1244,6 +1347,19 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1244
1347
  module.exports = defaults;
1245
1348
 
1246
1349
 
1350
+ /***/ }),
1351
+
1352
+ /***/ "./lib/env/data.js":
1353
+ /*!*************************!*\
1354
+ !*** ./lib/env/data.js ***!
1355
+ \*************************/
1356
+ /*! no static exports found */
1357
+ /***/ (function(module, exports) {
1358
+
1359
+ module.exports = {
1360
+ "version": "0.22.0"
1361
+ };
1362
+
1247
1363
  /***/ }),
1248
1364
 
1249
1365
  /***/ "./lib/helpers/bind.js":
@@ -1709,7 +1825,7 @@ module.exports = function spread(callback) {
1709
1825
  "use strict";
1710
1826
 
1711
1827
 
1712
- var pkg = __webpack_require__(/*! ./../../package.json */ "./package.json");
1828
+ var VERSION = __webpack_require__(/*! ../env/data */ "./lib/env/data.js").version;
1713
1829
 
1714
1830
  var validators = {};
1715
1831
 
@@ -1721,48 +1837,26 @@ var validators = {};
1721
1837
  });
1722
1838
 
1723
1839
  var deprecatedWarnings = {};
1724
- var currentVerArr = pkg.version.split('.');
1725
-
1726
- /**
1727
- * Compare package versions
1728
- * @param {string} version
1729
- * @param {string?} thanVersion
1730
- * @returns {boolean}
1731
- */
1732
- function isOlderVersion(version, thanVersion) {
1733
- var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
1734
- var destVer = version.split('.');
1735
- for (var i = 0; i < 3; i++) {
1736
- if (pkgVersionArr[i] > destVer[i]) {
1737
- return true;
1738
- } else if (pkgVersionArr[i] < destVer[i]) {
1739
- return false;
1740
- }
1741
- }
1742
- return false;
1743
- }
1744
1840
 
1745
1841
  /**
1746
1842
  * Transitional option validator
1747
- * @param {function|boolean?} validator
1748
- * @param {string?} version
1749
- * @param {string} message
1843
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
1844
+ * @param {string?} version - deprecated version / removed since version
1845
+ * @param {string?} message - some message with additional info
1750
1846
  * @returns {function}
1751
1847
  */
1752
1848
  validators.transitional = function transitional(validator, version, message) {
1753
- var isDeprecated = version && isOlderVersion(version);
1754
-
1755
1849
  function formatMessage(opt, desc) {
1756
- return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1850
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
1757
1851
  }
1758
1852
 
1759
1853
  // eslint-disable-next-line func-names
1760
1854
  return function(value, opt, opts) {
1761
1855
  if (validator === false) {
1762
- throw new Error(formatMessage(opt, ' has been removed in ' + version));
1856
+ throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
1763
1857
  }
1764
1858
 
1765
- if (isDeprecated && !deprecatedWarnings[opt]) {
1859
+ if (version && !deprecatedWarnings[opt]) {
1766
1860
  deprecatedWarnings[opt] = true;
1767
1861
  // eslint-disable-next-line no-console
1768
1862
  console.warn(
@@ -1808,7 +1902,6 @@ function assertOptions(options, schema, allowUnknown) {
1808
1902
  }
1809
1903
 
1810
1904
  module.exports = {
1811
- isOlderVersion: isOlderVersion,
1812
1905
  assertOptions: assertOptions,
1813
1906
  validators: validators
1814
1907
  };
@@ -2175,17 +2268,6 @@ module.exports = {
2175
2268
  };
2176
2269
 
2177
2270
 
2178
- /***/ }),
2179
-
2180
- /***/ "./package.json":
2181
- /*!**********************!*\
2182
- !*** ./package.json ***!
2183
- \**********************/
2184
- /*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, browser, jsdelivr, unpkg, typings, dependencies, bundlesize, default */
2185
- /***/ (function(module) {
2186
-
2187
- module.exports = JSON.parse("{\"name\":\"axios\",\"version\":\"0.21.4\",\"description\":\"Promise based HTTP client for the browser and node.js\",\"main\":\"index.js\",\"scripts\":{\"test\":\"grunt test\",\"start\":\"node ./sandbox/server.js\",\"build\":\"NODE_ENV=production grunt build\",\"preversion\":\"npm test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\",\"postversion\":\"git push && git push --tags\",\"examples\":\"node ./examples/server.js\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"fix\":\"eslint --fix lib/**/*.js\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/axios/axios.git\"},\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"author\":\"Matt Zabriskie\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"homepage\":\"https://axios-http.com\",\"devDependencies\":{\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.3.0\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^23.0.0\",\"grunt-karma\":\"^4.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^4.0.2\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^6.3.2\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-firefox-launcher\":\"^2.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^4.3.6\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.8\",\"karma-webpack\":\"^4.0.2\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^8.2.1\",\"sinon\":\"^4.5.0\",\"terser-webpack-plugin\":\"^4.2.3\",\"typescript\":\"^4.0.5\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^4.44.2\",\"webpack-dev-server\":\"^3.11.0\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"jsdelivr\":\"dist/axios.min.js\",\"unpkg\":\"dist/axios.min.js\",\"typings\":\"./index.d.ts\",\"dependencies\":{\"follow-redirects\":\"^1.14.0\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}]}");
2188
-
2189
2271
  /***/ })
2190
2272
 
2191
2273
  /******/ });