axios 1.1.2 → 1.2.0-alpha.1

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/dist/axios.js CHANGED
@@ -1,4 +1,4 @@
1
- // Axios v1.1.2 Copyright (c) 2022 Matt Zabriskie and contributors
1
+ // Axios v1.2.0-alpha.1 Copyright (c) 2022 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) :
@@ -14,13 +14,11 @@
14
14
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15
15
  }, _typeof(obj);
16
16
  }
17
-
18
17
  function _classCallCheck(instance, Constructor) {
19
18
  if (!(instance instanceof Constructor)) {
20
19
  throw new TypeError("Cannot call a class as a function");
21
20
  }
22
21
  }
23
-
24
22
  function _defineProperties(target, props) {
25
23
  for (var i = 0; i < props.length; i++) {
26
24
  var descriptor = props[i];
@@ -30,7 +28,6 @@
30
28
  Object.defineProperty(target, descriptor.key, descriptor);
31
29
  }
32
30
  }
33
-
34
31
  function _createClass(Constructor, protoProps, staticProps) {
35
32
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
36
33
  if (staticProps) _defineProperties(Constructor, staticProps);
@@ -39,6 +36,52 @@
39
36
  });
40
37
  return Constructor;
41
38
  }
39
+ function _slicedToArray(arr, i) {
40
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
41
+ }
42
+ function _arrayWithHoles(arr) {
43
+ if (Array.isArray(arr)) return arr;
44
+ }
45
+ function _iterableToArrayLimit(arr, i) {
46
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
47
+ if (_i == null) return;
48
+ var _arr = [];
49
+ var _n = true;
50
+ var _d = false;
51
+ var _s, _e;
52
+ try {
53
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
54
+ _arr.push(_s.value);
55
+ if (i && _arr.length === i) break;
56
+ }
57
+ } catch (err) {
58
+ _d = true;
59
+ _e = err;
60
+ } finally {
61
+ try {
62
+ if (!_n && _i["return"] != null) _i["return"]();
63
+ } finally {
64
+ if (_d) throw _e;
65
+ }
66
+ }
67
+ return _arr;
68
+ }
69
+ function _unsupportedIterableToArray(o, minLen) {
70
+ if (!o) return;
71
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
72
+ var n = Object.prototype.toString.call(o).slice(8, -1);
73
+ if (n === "Object" && o.constructor) n = o.constructor.name;
74
+ if (n === "Map" || n === "Set") return Array.from(o);
75
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
76
+ }
77
+ function _arrayLikeToArray(arr, len) {
78
+ if (len == null || len > arr.length) len = arr.length;
79
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
80
+ return arr2;
81
+ }
82
+ function _nonIterableRest() {
83
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
84
+ }
42
85
 
43
86
  function bind(fn, thisArg) {
44
87
  return function wrap() {
@@ -46,28 +89,28 @@
46
89
  };
47
90
  }
48
91
 
92
+ // utils is a library of generic helper functions non-specific to axios
93
+
49
94
  var toString = Object.prototype.toString;
50
95
  var getPrototypeOf = Object.getPrototypeOf;
51
-
52
96
  var kindOf = function (cache) {
53
97
  return function (thing) {
54
98
  var str = toString.call(thing);
55
99
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
56
100
  };
57
101
  }(Object.create(null));
58
-
59
102
  var kindOfTest = function kindOfTest(type) {
60
103
  type = type.toLowerCase();
61
104
  return function (thing) {
62
105
  return kindOf(thing) === type;
63
106
  };
64
107
  };
65
-
66
108
  var typeOfTest = function typeOfTest(type) {
67
109
  return function (thing) {
68
110
  return _typeof(thing) === type;
69
111
  };
70
112
  };
113
+
71
114
  /**
72
115
  * Determine if a value is an Array
73
116
  *
@@ -75,9 +118,8 @@
75
118
  *
76
119
  * @returns {boolean} True if value is an Array, otherwise false
77
120
  */
78
-
79
-
80
121
  var isArray = Array.isArray;
122
+
81
123
  /**
82
124
  * Determine if a value is undefined
83
125
  *
@@ -85,8 +127,8 @@
85
127
  *
86
128
  * @returns {boolean} True if the value is undefined, otherwise false
87
129
  */
88
-
89
130
  var isUndefined = typeOfTest('undefined');
131
+
90
132
  /**
91
133
  * Determine if a value is a Buffer
92
134
  *
@@ -94,10 +136,10 @@
94
136
  *
95
137
  * @returns {boolean} True if value is a Buffer, otherwise false
96
138
  */
97
-
98
139
  function isBuffer(val) {
99
140
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
100
141
  }
142
+
101
143
  /**
102
144
  * Determine if a value is an ArrayBuffer
103
145
  *
@@ -105,9 +147,8 @@
105
147
  *
106
148
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
107
149
  */
108
-
109
-
110
150
  var isArrayBuffer = kindOfTest('ArrayBuffer');
151
+
111
152
  /**
112
153
  * Determine if a value is a view on an ArrayBuffer
113
154
  *
@@ -115,18 +156,16 @@
115
156
  *
116
157
  * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
117
158
  */
118
-
119
159
  function isArrayBufferView(val) {
120
160
  var result;
121
-
122
161
  if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
123
162
  result = ArrayBuffer.isView(val);
124
163
  } else {
125
164
  result = val && val.buffer && isArrayBuffer(val.buffer);
126
165
  }
127
-
128
166
  return result;
129
167
  }
168
+
130
169
  /**
131
170
  * Determine if a value is a String
132
171
  *
@@ -134,17 +173,16 @@
134
173
  *
135
174
  * @returns {boolean} True if value is a String, otherwise false
136
175
  */
137
-
138
-
139
176
  var isString = typeOfTest('string');
177
+
140
178
  /**
141
179
  * Determine if a value is a Function
142
180
  *
143
181
  * @param {*} val The value to test
144
182
  * @returns {boolean} True if value is a Function, otherwise false
145
183
  */
146
-
147
184
  var isFunction = typeOfTest('function');
185
+
148
186
  /**
149
187
  * Determine if a value is a Number
150
188
  *
@@ -152,8 +190,8 @@
152
190
  *
153
191
  * @returns {boolean} True if value is a Number, otherwise false
154
192
  */
155
-
156
193
  var isNumber = typeOfTest('number');
194
+
157
195
  /**
158
196
  * Determine if a value is an Object
159
197
  *
@@ -161,21 +199,20 @@
161
199
  *
162
200
  * @returns {boolean} True if value is an Object, otherwise false
163
201
  */
164
-
165
202
  var isObject = function isObject(thing) {
166
203
  return thing !== null && _typeof(thing) === 'object';
167
204
  };
205
+
168
206
  /**
169
207
  * Determine if a value is a Boolean
170
208
  *
171
209
  * @param {*} thing The value to test
172
210
  * @returns {boolean} True if value is a Boolean, otherwise false
173
211
  */
174
-
175
-
176
212
  var isBoolean = function isBoolean(thing) {
177
213
  return thing === true || thing === false;
178
214
  };
215
+
179
216
  /**
180
217
  * Determine if a value is a plain Object
181
218
  *
@@ -183,16 +220,14 @@
183
220
  *
184
221
  * @returns {boolean} True if value is a plain Object, otherwise false
185
222
  */
186
-
187
-
188
223
  var isPlainObject = function isPlainObject(val) {
189
224
  if (kindOf(val) !== 'object') {
190
225
  return false;
191
226
  }
192
-
193
227
  var prototype = getPrototypeOf(val);
194
228
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
195
229
  };
230
+
196
231
  /**
197
232
  * Determine if a value is a Date
198
233
  *
@@ -200,9 +235,8 @@
200
235
  *
201
236
  * @returns {boolean} True if value is a Date, otherwise false
202
237
  */
203
-
204
-
205
238
  var isDate = kindOfTest('Date');
239
+
206
240
  /**
207
241
  * Determine if a value is a File
208
242
  *
@@ -210,8 +244,8 @@
210
244
  *
211
245
  * @returns {boolean} True if value is a File, otherwise false
212
246
  */
213
-
214
247
  var isFile = kindOfTest('File');
248
+
215
249
  /**
216
250
  * Determine if a value is a Blob
217
251
  *
@@ -219,8 +253,8 @@
219
253
  *
220
254
  * @returns {boolean} True if value is a Blob, otherwise false
221
255
  */
222
-
223
256
  var isBlob = kindOfTest('Blob');
257
+
224
258
  /**
225
259
  * Determine if a value is a FileList
226
260
  *
@@ -228,8 +262,8 @@
228
262
  *
229
263
  * @returns {boolean} True if value is a File, otherwise false
230
264
  */
231
-
232
265
  var isFileList = kindOfTest('FileList');
266
+
233
267
  /**
234
268
  * Determine if a value is a Stream
235
269
  *
@@ -237,10 +271,10 @@
237
271
  *
238
272
  * @returns {boolean} True if value is a Stream, otherwise false
239
273
  */
240
-
241
274
  var isStream = function isStream(val) {
242
275
  return isObject(val) && isFunction(val.pipe);
243
276
  };
277
+
244
278
  /**
245
279
  * Determine if a value is a FormData
246
280
  *
@@ -248,12 +282,11 @@
248
282
  *
249
283
  * @returns {boolean} True if value is an FormData, otherwise false
250
284
  */
251
-
252
-
253
285
  var isFormData = function isFormData(thing) {
254
286
  var pattern = '[object FormData]';
255
287
  return thing && (typeof FormData === 'function' && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
256
288
  };
289
+
257
290
  /**
258
291
  * Determine if a value is a URLSearchParams object
259
292
  *
@@ -261,9 +294,8 @@
261
294
  *
262
295
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
263
296
  */
264
-
265
-
266
297
  var isURLSearchParams = kindOfTest('URLSearchParams');
298
+
267
299
  /**
268
300
  * Trim excess whitespace off the beginning and end of a string
269
301
  *
@@ -271,10 +303,10 @@
271
303
  *
272
304
  * @returns {String} The String freed of excess whitespace
273
305
  */
274
-
275
306
  var trim = function trim(str) {
276
307
  return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
277
308
  };
309
+
278
310
  /**
279
311
  * Iterate over an Array or an Object invoking a function for each item.
280
312
  *
@@ -288,28 +320,24 @@
288
320
  * @param {Function} fn The callback to invoke for each item
289
321
  *
290
322
  * @param {Boolean} [allOwnKeys = false]
291
- * @returns {void}
323
+ * @returns {any}
292
324
  */
293
-
294
-
295
325
  function forEach(obj, fn) {
296
326
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
297
- _ref$allOwnKeys = _ref.allOwnKeys,
298
- allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
299
-
327
+ _ref$allOwnKeys = _ref.allOwnKeys,
328
+ allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
300
329
  // Don't bother if no value provided
301
330
  if (obj === null || typeof obj === 'undefined') {
302
331
  return;
303
332
  }
304
-
305
333
  var i;
306
- var l; // Force an array if not already something iterable
334
+ var l;
307
335
 
336
+ // Force an array if not already something iterable
308
337
  if (_typeof(obj) !== 'object') {
309
338
  /*eslint no-param-reassign:0*/
310
339
  obj = [obj];
311
340
  }
312
-
313
341
  if (isArray(obj)) {
314
342
  // Iterate over array values
315
343
  for (i = 0, l = obj.length; i < l; i++) {
@@ -320,13 +348,30 @@
320
348
  var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
321
349
  var len = keys.length;
322
350
  var key;
323
-
324
351
  for (i = 0; i < len; i++) {
325
352
  key = keys[i];
326
353
  fn.call(null, obj[key], key, obj);
327
354
  }
328
355
  }
329
356
  }
357
+ function findKey(obj, key) {
358
+ key = key.toLowerCase();
359
+ var keys = Object.keys(obj);
360
+ var i = keys.length;
361
+ var _key;
362
+ while (i-- > 0) {
363
+ _key = keys[i];
364
+ if (key === _key.toLowerCase()) {
365
+ return _key;
366
+ }
367
+ }
368
+ return null;
369
+ }
370
+ var _global = typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self;
371
+ var isContextDefined = function isContextDefined(context) {
372
+ return !isUndefined(context) && context !== _global;
373
+ };
374
+
330
375
  /**
331
376
  * Accepts varargs expecting each argument to be an object, then
332
377
  * immutably merges the properties of each object and returns result.
@@ -345,31 +390,29 @@
345
390
  *
346
391
  * @returns {Object} Result of all merge properties
347
392
  */
348
-
349
-
350
- function
351
- /* obj1, obj2, obj3, ... */
393
+ function /* obj1, obj2, obj3, ... */
352
394
  merge() {
395
+ var _ref2 = isContextDefined(this) && this || {},
396
+ caseless = _ref2.caseless;
353
397
  var result = {};
354
-
355
398
  var assignValue = function assignValue(val, key) {
356
- if (isPlainObject(result[key]) && isPlainObject(val)) {
357
- result[key] = merge(result[key], val);
399
+ var targetKey = caseless && findKey(result, key) || key;
400
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
401
+ result[targetKey] = merge(result[targetKey], val);
358
402
  } else if (isPlainObject(val)) {
359
- result[key] = merge({}, val);
403
+ result[targetKey] = merge({}, val);
360
404
  } else if (isArray(val)) {
361
- result[key] = val.slice();
405
+ result[targetKey] = val.slice();
362
406
  } else {
363
- result[key] = val;
407
+ result[targetKey] = val;
364
408
  }
365
409
  };
366
-
367
410
  for (var i = 0, l = arguments.length; i < l; i++) {
368
411
  arguments[i] && forEach(arguments[i], assignValue);
369
412
  }
370
-
371
413
  return result;
372
414
  }
415
+
373
416
  /**
374
417
  * Extends object a by mutably adding to it the properties of object b.
375
418
  *
@@ -380,12 +423,9 @@
380
423
  * @param {Boolean} [allOwnKeys]
381
424
  * @returns {Object} The resulting value of object a
382
425
  */
383
-
384
-
385
426
  var extend = function extend(a, b, thisArg) {
386
- var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
387
- allOwnKeys = _ref2.allOwnKeys;
388
-
427
+ var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
428
+ allOwnKeys = _ref3.allOwnKeys;
389
429
  forEach(b, function (val, key) {
390
430
  if (thisArg && isFunction(val)) {
391
431
  a[key] = bind(val, thisArg);
@@ -397,6 +437,7 @@
397
437
  });
398
438
  return a;
399
439
  };
440
+
400
441
  /**
401
442
  * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
402
443
  *
@@ -404,15 +445,13 @@
404
445
  *
405
446
  * @returns {string} content value without BOM
406
447
  */
407
-
408
-
409
448
  var stripBOM = function stripBOM(content) {
410
449
  if (content.charCodeAt(0) === 0xFEFF) {
411
450
  content = content.slice(1);
412
451
  }
413
-
414
452
  return content;
415
453
  };
454
+
416
455
  /**
417
456
  * Inherit the prototype methods from one constructor into another
418
457
  * @param {function} constructor
@@ -422,8 +461,6 @@
422
461
  *
423
462
  * @returns {void}
424
463
  */
425
-
426
-
427
464
  var inherits = function inherits(constructor, superConstructor, props, descriptors) {
428
465
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
429
466
  constructor.prototype.constructor = constructor;
@@ -432,6 +469,7 @@
432
469
  });
433
470
  props && Object.assign(constructor.prototype, props);
434
471
  };
472
+
435
473
  /**
436
474
  * Resolve object with deep prototype chain to a flat object
437
475
  * @param {Object} sourceObj source object
@@ -441,35 +479,29 @@
441
479
  *
442
480
  * @returns {Object}
443
481
  */
444
-
445
-
446
482
  var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) {
447
483
  var props;
448
484
  var i;
449
485
  var prop;
450
486
  var merged = {};
451
- destObj = destObj || {}; // eslint-disable-next-line no-eq-null,eqeqeq
452
-
487
+ destObj = destObj || {};
488
+ // eslint-disable-next-line no-eq-null,eqeqeq
453
489
  if (sourceObj == null) return destObj;
454
-
455
490
  do {
456
491
  props = Object.getOwnPropertyNames(sourceObj);
457
492
  i = props.length;
458
-
459
493
  while (i-- > 0) {
460
494
  prop = props[i];
461
-
462
495
  if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
463
496
  destObj[prop] = sourceObj[prop];
464
497
  merged[prop] = true;
465
498
  }
466
499
  }
467
-
468
500
  sourceObj = filter !== false && getPrototypeOf(sourceObj);
469
501
  } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
470
-
471
502
  return destObj;
472
503
  };
504
+
473
505
  /**
474
506
  * Determines whether a string ends with the characters of a specified string
475
507
  *
@@ -479,19 +511,16 @@
479
511
  *
480
512
  * @returns {boolean}
481
513
  */
482
-
483
-
484
514
  var endsWith = function endsWith(str, searchString, position) {
485
515
  str = String(str);
486
-
487
516
  if (position === undefined || position > str.length) {
488
517
  position = str.length;
489
518
  }
490
-
491
519
  position -= searchString.length;
492
520
  var lastIndex = str.indexOf(searchString, position);
493
521
  return lastIndex !== -1 && lastIndex === position;
494
522
  };
523
+
495
524
  /**
496
525
  * Returns new array from array like object or null if failed
497
526
  *
@@ -499,21 +528,18 @@
499
528
  *
500
529
  * @returns {?Array}
501
530
  */
502
-
503
-
504
531
  var toArray = function toArray(thing) {
505
532
  if (!thing) return null;
506
533
  if (isArray(thing)) return thing;
507
534
  var i = thing.length;
508
535
  if (!isNumber(i)) return null;
509
536
  var arr = new Array(i);
510
-
511
537
  while (i-- > 0) {
512
538
  arr[i] = thing[i];
513
539
  }
514
-
515
540
  return arr;
516
541
  };
542
+
517
543
  /**
518
544
  * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
519
545
  * thing passed in is an instance of Uint8Array
@@ -523,14 +549,13 @@
523
549
  * @returns {Array}
524
550
  */
525
551
  // eslint-disable-next-line func-names
526
-
527
-
528
552
  var isTypedArray = function (TypedArray) {
529
553
  // eslint-disable-next-line func-names
530
554
  return function (thing) {
531
555
  return TypedArray && thing instanceof TypedArray;
532
556
  };
533
557
  }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
558
+
534
559
  /**
535
560
  * For each entry in the object, call the function with the key and value.
536
561
  *
@@ -539,18 +564,16 @@
539
564
  *
540
565
  * @returns {void}
541
566
  */
542
-
543
-
544
567
  var forEachEntry = function forEachEntry(obj, fn) {
545
568
  var generator = obj && obj[Symbol.iterator];
546
569
  var iterator = generator.call(obj);
547
570
  var result;
548
-
549
571
  while ((result = iterator.next()) && !result.done) {
550
572
  var pair = result.value;
551
573
  fn.call(obj, pair[0], pair[1]);
552
574
  }
553
575
  };
576
+
554
577
  /**
555
578
  * It takes a regular expression and a string, and returns an array of all the matches
556
579
  *
@@ -559,37 +582,31 @@
559
582
  *
560
583
  * @returns {Array<boolean>}
561
584
  */
562
-
563
-
564
585
  var matchAll = function matchAll(regExp, str) {
565
586
  var matches;
566
587
  var arr = [];
567
-
568
588
  while ((matches = regExp.exec(str)) !== null) {
569
589
  arr.push(matches);
570
590
  }
571
-
572
591
  return arr;
573
592
  };
574
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
575
-
576
593
 
594
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
577
595
  var isHTMLForm = kindOfTest('HTMLFormElement');
578
-
579
596
  var toCamelCase = function toCamelCase(str) {
580
597
  return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
581
598
  return p1.toUpperCase() + p2;
582
599
  });
583
600
  };
584
- /* Creating a function that will check if an object has a property. */
585
-
586
601
 
587
- var hasOwnProperty = function (_ref3) {
588
- var hasOwnProperty = _ref3.hasOwnProperty;
602
+ /* Creating a function that will check if an object has a property. */
603
+ var hasOwnProperty = function (_ref4) {
604
+ var hasOwnProperty = _ref4.hasOwnProperty;
589
605
  return function (obj, prop) {
590
606
  return hasOwnProperty.call(obj, prop);
591
607
  };
592
608
  }(Object.prototype);
609
+
593
610
  /**
594
611
  * Determine if a value is a RegExp object
595
612
  *
@@ -597,10 +614,7 @@
597
614
  *
598
615
  * @returns {boolean} True if value is a RegExp object, otherwise false
599
616
  */
600
-
601
-
602
617
  var isRegExp = kindOfTest('RegExp');
603
-
604
618
  var reduceDescriptors = function reduceDescriptors(obj, reducer) {
605
619
  var descriptors = Object.getOwnPropertyDescriptors(obj);
606
620
  var reducedDescriptors = {};
@@ -611,51 +625,47 @@
611
625
  });
612
626
  Object.defineProperties(obj, reducedDescriptors);
613
627
  };
628
+
614
629
  /**
615
630
  * Makes all methods read-only
616
631
  * @param {Object} obj
617
632
  */
618
633
 
619
-
620
634
  var freezeMethods = function freezeMethods(obj) {
621
635
  reduceDescriptors(obj, function (descriptor, name) {
636
+ // skip restricted props in strict mode
637
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
638
+ return false;
639
+ }
622
640
  var value = obj[name];
623
641
  if (!isFunction(value)) return;
624
642
  descriptor.enumerable = false;
625
-
626
643
  if ('writable' in descriptor) {
627
644
  descriptor.writable = false;
628
645
  return;
629
646
  }
630
-
631
647
  if (!descriptor.set) {
632
648
  descriptor.set = function () {
633
- throw Error('Can not read-only method \'' + name + '\'');
649
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
634
650
  };
635
651
  }
636
652
  });
637
653
  };
638
-
639
654
  var toObjectSet = function toObjectSet(arrayOrString, delimiter) {
640
655
  var obj = {};
641
-
642
656
  var define = function define(arr) {
643
657
  arr.forEach(function (value) {
644
658
  obj[value] = true;
645
659
  });
646
660
  };
647
-
648
661
  isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
649
662
  return obj;
650
663
  };
651
-
652
664
  var noop = function noop() {};
653
-
654
665
  var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
655
666
  value = +value;
656
667
  return Number.isFinite(value) ? value : defaultValue;
657
668
  };
658
-
659
669
  var utils = {
660
670
  isArray: isArray,
661
671
  isArrayBuffer: isArrayBuffer,
@@ -699,7 +709,10 @@
699
709
  toObjectSet: toObjectSet,
700
710
  toCamelCase: toCamelCase,
701
711
  noop: noop,
702
- toFiniteNumber: toFiniteNumber
712
+ toFiniteNumber: toFiniteNumber,
713
+ findKey: findKey,
714
+ global: _global,
715
+ isContextDefined: isContextDefined
703
716
  };
704
717
 
705
718
  /**
@@ -713,16 +726,13 @@
713
726
  *
714
727
  * @returns {Error} The created error.
715
728
  */
716
-
717
729
  function AxiosError(message, code, config, request, response) {
718
730
  Error.call(this);
719
-
720
731
  if (Error.captureStackTrace) {
721
732
  Error.captureStackTrace(this, this.constructor);
722
733
  } else {
723
734
  this.stack = new Error().stack;
724
735
  }
725
-
726
736
  this.message = message;
727
737
  this.name = 'AxiosError';
728
738
  code && (this.code = code);
@@ -730,7 +740,6 @@
730
740
  request && (this.request = request);
731
741
  response && (this.response = response);
732
742
  }
733
-
734
743
  utils.inherits(AxiosError, Error, {
735
744
  toJSON: function toJSON() {
736
745
  return {
@@ -754,7 +763,8 @@
754
763
  });
755
764
  var prototype$1 = AxiosError.prototype;
756
765
  var descriptors = {};
757
- ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL' // eslint-disable-next-line func-names
766
+ ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL'
767
+ // eslint-disable-next-line func-names
758
768
  ].forEach(function (code) {
759
769
  descriptors[code] = {
760
770
  value: code
@@ -763,8 +773,9 @@
763
773
  Object.defineProperties(AxiosError, descriptors);
764
774
  Object.defineProperty(prototype$1, 'isAxiosError', {
765
775
  value: true
766
- }); // eslint-disable-next-line func-names
776
+ });
767
777
 
778
+ // eslint-disable-next-line func-names
768
779
  AxiosError.from = function (error, code, config, request, response, customProps) {
769
780
  var axiosError = Object.create(prototype$1);
770
781
  utils.toFlatObject(error, axiosError, function filter(obj) {
@@ -781,6 +792,7 @@
781
792
 
782
793
  /* eslint-env browser */
783
794
  var browser = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' ? self.FormData : window.FormData;
795
+ var FormData$2 = browser;
784
796
 
785
797
  /**
786
798
  * Determines if the given thing is a array or js object.
@@ -789,10 +801,10 @@
789
801
  *
790
802
  * @returns {boolean}
791
803
  */
792
-
793
804
  function isVisitable(thing) {
794
805
  return utils.isPlainObject(thing) || utils.isArray(thing);
795
806
  }
807
+
796
808
  /**
797
809
  * It removes the brackets from the end of a string
798
810
  *
@@ -800,11 +812,10 @@
800
812
  *
801
813
  * @returns {string} the key without the brackets.
802
814
  */
803
-
804
-
805
815
  function removeBrackets(key) {
806
816
  return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
807
817
  }
818
+
808
819
  /**
809
820
  * It takes a path, a key, and a boolean, and returns a string
810
821
  *
@@ -814,8 +825,6 @@
814
825
  *
815
826
  * @returns {string} The path to the current key.
816
827
  */
817
-
818
-
819
828
  function renderKey(path, key, dots) {
820
829
  if (!path) return key;
821
830
  return path.concat(key).map(function each(token, i) {
@@ -824,6 +833,7 @@
824
833
  return !dots && i ? '[' + token + ']' : token;
825
834
  }).join(dots ? '.' : '');
826
835
  }
836
+
827
837
  /**
828
838
  * If the array is an array and none of its elements are visitable, then it's a flat array.
829
839
  *
@@ -831,15 +841,13 @@
831
841
  *
832
842
  * @returns {boolean}
833
843
  */
834
-
835
-
836
844
  function isFlatArray(arr) {
837
845
  return utils.isArray(arr) && !arr.some(isVisitable);
838
846
  }
839
-
840
847
  var predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
841
848
  return /^is[A-Z]/.test(prop);
842
849
  });
850
+
843
851
  /**
844
852
  * If the thing is a FormData object, return true, otherwise return false.
845
853
  *
@@ -847,10 +855,10 @@
847
855
  *
848
856
  * @returns {boolean}
849
857
  */
850
-
851
858
  function isSpecCompliant(thing) {
852
859
  return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
853
860
  }
861
+
854
862
  /**
855
863
  * Convert a data object to FormData
856
864
  *
@@ -874,16 +882,15 @@
874
882
  *
875
883
  * @returns
876
884
  */
877
-
878
-
879
885
  function toFormData(obj, formData, options) {
880
886
  if (!utils.isObject(obj)) {
881
887
  throw new TypeError('target must be an object');
882
- } // eslint-disable-next-line no-param-reassign
883
-
888
+ }
884
889
 
885
- formData = formData || new (browser || FormData)(); // eslint-disable-next-line no-param-reassign
890
+ // eslint-disable-next-line no-param-reassign
891
+ formData = formData || new (FormData$2 || FormData)();
886
892
 
893
+ // eslint-disable-next-line no-param-reassign
887
894
  options = utils.toFlatObject(options, {
888
895
  metaTokens: true,
889
896
  dots: false,
@@ -892,37 +899,30 @@
892
899
  // eslint-disable-next-line no-eq-null,eqeqeq
893
900
  return !utils.isUndefined(source[option]);
894
901
  });
895
- var metaTokens = options.metaTokens; // eslint-disable-next-line no-use-before-define
896
-
902
+ var metaTokens = options.metaTokens;
903
+ // eslint-disable-next-line no-use-before-define
897
904
  var visitor = options.visitor || defaultVisitor;
898
905
  var dots = options.dots;
899
906
  var indexes = options.indexes;
900
-
901
907
  var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
902
-
903
908
  var useBlob = _Blob && isSpecCompliant(formData);
904
-
905
909
  if (!utils.isFunction(visitor)) {
906
910
  throw new TypeError('visitor must be a function');
907
911
  }
908
-
909
912
  function convertValue(value) {
910
913
  if (value === null) return '';
911
-
912
914
  if (utils.isDate(value)) {
913
915
  return value.toISOString();
914
916
  }
915
-
916
917
  if (!useBlob && utils.isBlob(value)) {
917
918
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
918
919
  }
919
-
920
920
  if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
921
921
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
922
922
  }
923
-
924
923
  return value;
925
924
  }
925
+
926
926
  /**
927
927
  * Default visitor.
928
928
  *
@@ -933,65 +933,54 @@
933
933
  *
934
934
  * @returns {boolean} return true to visit the each prop of the value recursively
935
935
  */
936
-
937
-
938
936
  function defaultVisitor(value, key, path) {
939
937
  var arr = value;
940
-
941
938
  if (value && !path && _typeof(value) === 'object') {
942
939
  if (utils.endsWith(key, '{}')) {
943
940
  // eslint-disable-next-line no-param-reassign
944
- key = metaTokens ? key : key.slice(0, -2); // eslint-disable-next-line no-param-reassign
945
-
941
+ key = metaTokens ? key : key.slice(0, -2);
942
+ // eslint-disable-next-line no-param-reassign
946
943
  value = JSON.stringify(value);
947
944
  } else if (utils.isArray(value) && isFlatArray(value) || utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
948
945
  // eslint-disable-next-line no-param-reassign
949
946
  key = removeBrackets(key);
950
947
  arr.forEach(function each(el, index) {
951
- !utils.isUndefined(el) && formData.append( // eslint-disable-next-line no-nested-ternary
948
+ !(utils.isUndefined(el) || el === null) && formData.append(
949
+ // eslint-disable-next-line no-nested-ternary
952
950
  indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
953
951
  });
954
952
  return false;
955
953
  }
956
954
  }
957
-
958
955
  if (isVisitable(value)) {
959
956
  return true;
960
957
  }
961
-
962
958
  formData.append(renderKey(path, key, dots), convertValue(value));
963
959
  return false;
964
960
  }
965
-
966
961
  var stack = [];
967
962
  var exposedHelpers = Object.assign(predicates, {
968
963
  defaultVisitor: defaultVisitor,
969
964
  convertValue: convertValue,
970
965
  isVisitable: isVisitable
971
966
  });
972
-
973
967
  function build(value, path) {
974
968
  if (utils.isUndefined(value)) return;
975
-
976
969
  if (stack.indexOf(value) !== -1) {
977
970
  throw Error('Circular reference detected in ' + path.join('.'));
978
971
  }
979
-
980
972
  stack.push(value);
981
973
  utils.forEach(value, function each(el, key) {
982
- var result = !utils.isUndefined(el) && visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
983
-
974
+ var result = !(utils.isUndefined(el) || el === null) && visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);
984
975
  if (result === true) {
985
976
  build(el, path ? path.concat(key) : [key]);
986
977
  }
987
978
  });
988
979
  stack.pop();
989
980
  }
990
-
991
981
  if (!utils.isObject(obj)) {
992
982
  throw new TypeError('data must be an object');
993
983
  }
994
-
995
984
  build(obj);
996
985
  return formData;
997
986
  }
@@ -1004,7 +993,6 @@
1004
993
  *
1005
994
  * @returns {string} The encoded string.
1006
995
  */
1007
-
1008
996
  function encode$1(str) {
1009
997
  var charMap = {
1010
998
  '!': '%21',
@@ -1019,6 +1007,7 @@
1019
1007
  return charMap[match];
1020
1008
  });
1021
1009
  }
1010
+
1022
1011
  /**
1023
1012
  * It takes a params object and converts it to a FormData object
1024
1013
  *
@@ -1027,24 +1016,18 @@
1027
1016
  *
1028
1017
  * @returns {void}
1029
1018
  */
1030
-
1031
-
1032
1019
  function AxiosURLSearchParams(params, options) {
1033
1020
  this._pairs = [];
1034
1021
  params && toFormData(params, this, options);
1035
1022
  }
1036
-
1037
1023
  var prototype = AxiosURLSearchParams.prototype;
1038
-
1039
1024
  prototype.append = function append(name, value) {
1040
1025
  this._pairs.push([name, value]);
1041
1026
  };
1042
-
1043
1027
  prototype.toString = function toString(encoder) {
1044
1028
  var _encode = encoder ? function (value) {
1045
1029
  return encoder.call(this, value, encode$1);
1046
1030
  } : encode$1;
1047
-
1048
1031
  return this._pairs.map(function each(pair) {
1049
1032
  return _encode(pair[0]) + '=' + _encode(pair[1]);
1050
1033
  }, '').join('&');
@@ -1058,10 +1041,10 @@
1058
1041
  *
1059
1042
  * @returns {string} The encoded value.
1060
1043
  */
1061
-
1062
1044
  function encode(val) {
1063
1045
  return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
1064
1046
  }
1047
+
1065
1048
  /**
1066
1049
  * Build a URL by appending params to the end
1067
1050
  *
@@ -1071,37 +1054,35 @@
1071
1054
  *
1072
1055
  * @returns {string} The formatted url
1073
1056
  */
1074
-
1075
-
1076
1057
  function buildURL(url, params, options) {
1077
1058
  /*eslint no-param-reassign:0*/
1078
1059
  if (!params) {
1079
1060
  return url;
1080
1061
  }
1081
-
1082
- var hashmarkIndex = url.indexOf('#');
1083
-
1084
- if (hashmarkIndex !== -1) {
1085
- url = url.slice(0, hashmarkIndex);
1086
- }
1087
-
1088
1062
  var _encode = options && options.encode || encode;
1089
-
1090
- var serializerParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
1091
-
1092
- if (serializerParams) {
1093
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
1063
+ var serializeFn = options && options.serialize;
1064
+ var serializedParams;
1065
+ if (serializeFn) {
1066
+ serializedParams = serializeFn(params, options);
1067
+ } else {
1068
+ serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
1069
+ }
1070
+ if (serializedParams) {
1071
+ var hashmarkIndex = url.indexOf("#");
1072
+ if (hashmarkIndex !== -1) {
1073
+ url = url.slice(0, hashmarkIndex);
1074
+ }
1075
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1094
1076
  }
1095
-
1096
1077
  return url;
1097
1078
  }
1098
1079
 
1099
1080
  var InterceptorManager = /*#__PURE__*/function () {
1100
1081
  function InterceptorManager() {
1101
1082
  _classCallCheck(this, InterceptorManager);
1102
-
1103
1083
  this.handlers = [];
1104
1084
  }
1085
+
1105
1086
  /**
1106
1087
  * Add a new interceptor to the stack
1107
1088
  *
@@ -1110,8 +1091,6 @@
1110
1091
  *
1111
1092
  * @return {Number} An ID used to remove interceptor later
1112
1093
  */
1113
-
1114
-
1115
1094
  _createClass(InterceptorManager, [{
1116
1095
  key: "use",
1117
1096
  value: function use(fulfilled, rejected, options) {
@@ -1123,6 +1102,7 @@
1123
1102
  });
1124
1103
  return this.handlers.length - 1;
1125
1104
  }
1105
+
1126
1106
  /**
1127
1107
  * Remove an interceptor from the stack
1128
1108
  *
@@ -1130,7 +1110,6 @@
1130
1110
  *
1131
1111
  * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1132
1112
  */
1133
-
1134
1113
  }, {
1135
1114
  key: "eject",
1136
1115
  value: function eject(id) {
@@ -1138,12 +1117,12 @@
1138
1117
  this.handlers[id] = null;
1139
1118
  }
1140
1119
  }
1120
+
1141
1121
  /**
1142
1122
  * Clear all interceptors from the stack
1143
1123
  *
1144
1124
  * @returns {void}
1145
1125
  */
1146
-
1147
1126
  }, {
1148
1127
  key: "clear",
1149
1128
  value: function clear() {
@@ -1151,6 +1130,7 @@
1151
1130
  this.handlers = [];
1152
1131
  }
1153
1132
  }
1133
+
1154
1134
  /**
1155
1135
  * Iterate over all the registered interceptors
1156
1136
  *
@@ -1161,7 +1141,6 @@
1161
1141
  *
1162
1142
  * @returns {void}
1163
1143
  */
1164
-
1165
1144
  }, {
1166
1145
  key: "forEach",
1167
1146
  value: function forEach(fn) {
@@ -1172,9 +1151,9 @@
1172
1151
  });
1173
1152
  }
1174
1153
  }]);
1175
-
1176
1154
  return InterceptorManager;
1177
1155
  }();
1156
+ var InterceptorManager$1 = InterceptorManager;
1178
1157
 
1179
1158
  var transitionalDefaults = {
1180
1159
  silentJSONParsing: true,
@@ -1203,17 +1182,13 @@
1203
1182
  *
1204
1183
  * @returns {boolean}
1205
1184
  */
1206
-
1207
1185
  var isStandardBrowserEnv = function () {
1208
1186
  var product;
1209
-
1210
1187
  if (typeof navigator !== 'undefined' && ((product = navigator.product) === 'ReactNative' || product === 'NativeScript' || product === 'NS')) {
1211
1188
  return false;
1212
1189
  }
1213
-
1214
1190
  return typeof window !== 'undefined' && typeof document !== 'undefined';
1215
1191
  }();
1216
-
1217
1192
  var platform = {
1218
1193
  isBrowser: true,
1219
1194
  classes: {
@@ -1232,7 +1207,6 @@
1232
1207
  this.append(key, value.toString('base64'));
1233
1208
  return false;
1234
1209
  }
1235
-
1236
1210
  return helpers.defaultVisitor.apply(this, arguments);
1237
1211
  }
1238
1212
  }, options));
@@ -1245,7 +1219,6 @@
1245
1219
  *
1246
1220
  * @returns An array of strings.
1247
1221
  */
1248
-
1249
1222
  function parsePropPath(name) {
1250
1223
  // foo[x][y][z]
1251
1224
  // foo.x.y.z
@@ -1255,6 +1228,7 @@
1255
1228
  return match[0] === '[]' ? '' : match[1] || match[0];
1256
1229
  });
1257
1230
  }
1231
+
1258
1232
  /**
1259
1233
  * Convert an array to an object.
1260
1234
  *
@@ -1262,22 +1236,19 @@
1262
1236
  *
1263
1237
  * @returns An object with the same keys and values as the array.
1264
1238
  */
1265
-
1266
-
1267
1239
  function arrayToObject(arr) {
1268
1240
  var obj = {};
1269
1241
  var keys = Object.keys(arr);
1270
1242
  var i;
1271
1243
  var len = keys.length;
1272
1244
  var key;
1273
-
1274
1245
  for (i = 0; i < len; i++) {
1275
1246
  key = keys[i];
1276
1247
  obj[key] = arr[key];
1277
1248
  }
1278
-
1279
1249
  return obj;
1280
1250
  }
1251
+
1281
1252
  /**
1282
1253
  * It takes a FormData object and returns a JavaScript object
1283
1254
  *
@@ -1285,38 +1256,29 @@
1285
1256
  *
1286
1257
  * @returns {Object<string, any> | null} The converted object.
1287
1258
  */
1288
-
1289
-
1290
1259
  function formDataToJSON(formData) {
1291
1260
  function buildPath(path, value, target, index) {
1292
1261
  var name = path[index++];
1293
1262
  var isNumericKey = Number.isFinite(+name);
1294
1263
  var isLast = index >= path.length;
1295
1264
  name = !name && utils.isArray(target) ? target.length : name;
1296
-
1297
1265
  if (isLast) {
1298
1266
  if (utils.hasOwnProp(target, name)) {
1299
1267
  target[name] = [target[name], value];
1300
1268
  } else {
1301
1269
  target[name] = value;
1302
1270
  }
1303
-
1304
1271
  return !isNumericKey;
1305
1272
  }
1306
-
1307
1273
  if (!target[name] || !utils.isObject(target[name])) {
1308
1274
  target[name] = [];
1309
1275
  }
1310
-
1311
1276
  var result = buildPath(path, value, target[name], index);
1312
-
1313
1277
  if (result && utils.isArray(target[name])) {
1314
1278
  target[name] = arrayToObject(target[name]);
1315
1279
  }
1316
-
1317
1280
  return !isNumericKey;
1318
1281
  }
1319
-
1320
1282
  if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1321
1283
  var obj = {};
1322
1284
  utils.forEachEntry(formData, function (name, value) {
@@ -1324,7 +1286,6 @@
1324
1286
  });
1325
1287
  return obj;
1326
1288
  }
1327
-
1328
1289
  return null;
1329
1290
  }
1330
1291
 
@@ -1337,10 +1298,8 @@
1337
1298
  *
1338
1299
  * @returns {object} The response.
1339
1300
  */
1340
-
1341
1301
  function settle(resolve, reject, response) {
1342
1302
  var validateStatus = response.config.validateStatus;
1343
-
1344
1303
  if (!response.status || !validateStatus || validateStatus(response.status)) {
1345
1304
  resolve(response);
1346
1305
  } else {
@@ -1348,29 +1307,25 @@
1348
1307
  }
1349
1308
  }
1350
1309
 
1351
- var cookies = platform.isStandardBrowserEnv ? // Standard browser envs support document.cookie
1310
+ var cookies = platform.isStandardBrowserEnv ?
1311
+ // Standard browser envs support document.cookie
1352
1312
  function standardBrowserEnv() {
1353
1313
  return {
1354
1314
  write: function write(name, value, expires, path, domain, secure) {
1355
1315
  var cookie = [];
1356
1316
  cookie.push(name + '=' + encodeURIComponent(value));
1357
-
1358
1317
  if (utils.isNumber(expires)) {
1359
1318
  cookie.push('expires=' + new Date(expires).toGMTString());
1360
1319
  }
1361
-
1362
1320
  if (utils.isString(path)) {
1363
1321
  cookie.push('path=' + path);
1364
1322
  }
1365
-
1366
1323
  if (utils.isString(domain)) {
1367
1324
  cookie.push('domain=' + domain);
1368
1325
  }
1369
-
1370
1326
  if (secure === true) {
1371
1327
  cookie.push('secure');
1372
1328
  }
1373
-
1374
1329
  document.cookie = cookie.join('; ');
1375
1330
  },
1376
1331
  read: function read(name) {
@@ -1381,7 +1336,8 @@
1381
1336
  this.write(name, '', Date.now() - 86400000);
1382
1337
  }
1383
1338
  };
1384
- }() : // Non standard browser env (web workers, react-native) lack needed support.
1339
+ }() :
1340
+ // Non standard browser env (web workers, react-native) lack needed support.
1385
1341
  function nonStandardBrowserEnv() {
1386
1342
  return {
1387
1343
  write: function write() {},
@@ -1399,7 +1355,6 @@
1399
1355
  *
1400
1356
  * @returns {boolean} True if the specified URL is absolute, otherwise false
1401
1357
  */
1402
-
1403
1358
  function isAbsoluteURL(url) {
1404
1359
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1405
1360
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
@@ -1415,7 +1370,6 @@
1415
1370
  *
1416
1371
  * @returns {string} The combined URL
1417
1372
  */
1418
-
1419
1373
  function combineURLs(baseURL, relativeURL) {
1420
1374
  return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
1421
1375
  }
@@ -1430,39 +1384,37 @@
1430
1384
  *
1431
1385
  * @returns {string} The combined full path
1432
1386
  */
1433
-
1434
1387
  function buildFullPath(baseURL, requestedURL) {
1435
1388
  if (baseURL && !isAbsoluteURL(requestedURL)) {
1436
1389
  return combineURLs(baseURL, requestedURL);
1437
1390
  }
1438
-
1439
1391
  return requestedURL;
1440
1392
  }
1441
1393
 
1442
- var isURLSameOrigin = platform.isStandardBrowserEnv ? // Standard browser envs have full support of the APIs needed to test
1394
+ var isURLSameOrigin = platform.isStandardBrowserEnv ?
1395
+ // Standard browser envs have full support of the APIs needed to test
1443
1396
  // whether the request URL is of the same origin as current location.
1444
1397
  function standardBrowserEnv() {
1445
1398
  var msie = /(msie|trident)/i.test(navigator.userAgent);
1446
1399
  var urlParsingNode = document.createElement('a');
1447
1400
  var originURL;
1401
+
1448
1402
  /**
1449
1403
  * Parse a URL to discover it's components
1450
1404
  *
1451
1405
  * @param {String} url The URL to be parsed
1452
1406
  * @returns {Object}
1453
1407
  */
1454
-
1455
1408
  function resolveURL(url) {
1456
1409
  var href = url;
1457
-
1458
1410
  if (msie) {
1459
1411
  // IE needs attribute set twice to normalize properties
1460
1412
  urlParsingNode.setAttribute('href', href);
1461
1413
  href = urlParsingNode.href;
1462
1414
  }
1415
+ urlParsingNode.setAttribute('href', href);
1463
1416
 
1464
- urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1465
-
1417
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1466
1418
  return {
1467
1419
  href: urlParsingNode.href,
1468
1420
  protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
@@ -1474,20 +1426,20 @@
1474
1426
  pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
1475
1427
  };
1476
1428
  }
1477
-
1478
1429
  originURL = resolveURL(window.location.href);
1430
+
1479
1431
  /**
1480
1432
  * Determine if a URL shares the same origin as the current location
1481
1433
  *
1482
1434
  * @param {String} requestURL The URL to test
1483
1435
  * @returns {boolean} True if URL shares the same origin, otherwise false
1484
1436
  */
1485
-
1486
1437
  return function isURLSameOrigin(requestURL) {
1487
1438
  var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
1488
1439
  return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
1489
1440
  };
1490
- }() : // Non standard browser envs (web workers, react-native) lack needed support.
1441
+ }() :
1442
+ // Non standard browser envs (web workers, react-native) lack needed support.
1491
1443
  function nonStandardBrowserEnv() {
1492
1444
  return function isURLSameOrigin() {
1493
1445
  return true;
@@ -1503,13 +1455,11 @@
1503
1455
  *
1504
1456
  * @returns {CanceledError} The created error.
1505
1457
  */
1506
-
1507
1458
  function CanceledError(message, config, request) {
1508
1459
  // eslint-disable-next-line no-eq-null,eqeqeq
1509
1460
  AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1510
1461
  this.name = 'CanceledError';
1511
1462
  }
1512
-
1513
1463
  utils.inherits(CanceledError, AxiosError, {
1514
1464
  __CANCEL__: true
1515
1465
  });
@@ -1519,9 +1469,10 @@
1519
1469
  return match && match[1] || '';
1520
1470
  }
1521
1471
 
1472
+ // RawAxiosHeaders whose duplicates are ignored by node
1522
1473
  // c.f. https://nodejs.org/api/http.html#http_message_headers
1523
-
1524
1474
  var ignoreDuplicateOf = utils.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
1475
+
1525
1476
  /**
1526
1477
  * Parse headers into an object
1527
1478
  *
@@ -1536,7 +1487,6 @@
1536
1487
  *
1537
1488
  * @returns {Object} Headers parsed into an object
1538
1489
  */
1539
-
1540
1490
  var parseHeaders = (function (rawHeaders) {
1541
1491
  var parsed = {};
1542
1492
  var key;
@@ -1546,11 +1496,9 @@
1546
1496
  i = line.indexOf(':');
1547
1497
  key = line.substring(0, i).trim().toLowerCase();
1548
1498
  val = line.substring(i + 1).trim();
1549
-
1550
1499
  if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1551
1500
  return;
1552
1501
  }
1553
-
1554
1502
  if (key === 'set-cookie') {
1555
1503
  if (parsed[key]) {
1556
1504
  parsed[key].push(val);
@@ -1565,54 +1513,44 @@
1565
1513
  });
1566
1514
 
1567
1515
  var $internals = Symbol('internals');
1568
- var $defaults = Symbol('defaults');
1569
-
1570
1516
  function normalizeHeader(header) {
1571
1517
  return header && String(header).trim().toLowerCase();
1572
1518
  }
1573
-
1574
1519
  function normalizeValue(value) {
1575
1520
  if (value === false || value == null) {
1576
1521
  return value;
1577
1522
  }
1578
-
1579
- return String(value);
1523
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1580
1524
  }
1581
-
1582
1525
  function parseTokens(str) {
1583
1526
  var tokens = Object.create(null);
1584
1527
  var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1585
1528
  var match;
1586
-
1587
1529
  while (match = tokensRE.exec(str)) {
1588
1530
  tokens[match[1]] = match[2];
1589
1531
  }
1590
-
1591
1532
  return tokens;
1592
1533
  }
1593
-
1534
+ function isValidHeaderName(str) {
1535
+ return /^[-_a-zA-Z]+$/.test(str.trim());
1536
+ }
1594
1537
  function matchHeaderValue(context, value, header, filter) {
1595
1538
  if (utils.isFunction(filter)) {
1596
1539
  return filter.call(this, value, header);
1597
1540
  }
1598
-
1599
1541
  if (!utils.isString(value)) return;
1600
-
1601
1542
  if (utils.isString(filter)) {
1602
1543
  return value.indexOf(filter) !== -1;
1603
1544
  }
1604
-
1605
1545
  if (utils.isRegExp(filter)) {
1606
1546
  return filter.test(value);
1607
1547
  }
1608
1548
  }
1609
-
1610
1549
  function formatHeader(header) {
1611
1550
  return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
1612
1551
  return _char.toUpperCase() + str;
1613
1552
  });
1614
1553
  }
1615
-
1616
1554
  function buildAccessors(obj, header) {
1617
1555
  var accessorName = utils.toCamelCase(' ' + header);
1618
1556
  ['get', 'set', 'has'].forEach(function (methodName) {
@@ -1624,194 +1562,201 @@
1624
1562
  });
1625
1563
  });
1626
1564
  }
1627
-
1628
- function findKey(obj, key) {
1629
- key = key.toLowerCase();
1630
- var keys = Object.keys(obj);
1631
- var i = keys.length;
1632
-
1633
- var _key;
1634
-
1635
- while (i-- > 0) {
1636
- _key = keys[i];
1637
-
1638
- if (key === _key.toLowerCase()) {
1639
- return _key;
1640
- }
1565
+ var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) {
1566
+ function AxiosHeaders(headers) {
1567
+ _classCallCheck(this, AxiosHeaders);
1568
+ headers && this.set(headers);
1641
1569
  }
1642
-
1643
- return null;
1644
- }
1645
-
1646
- function AxiosHeaders(headers, defaults) {
1647
- headers && this.set(headers);
1648
- this[$defaults] = defaults || null;
1649
- }
1650
-
1651
- Object.assign(AxiosHeaders.prototype, {
1652
- set: function set(header, valueOrRewrite, rewrite) {
1653
- var self = this;
1654
-
1655
- function setHeader(_value, _header, _rewrite) {
1656
- var lHeader = normalizeHeader(_header);
1657
-
1658
- if (!lHeader) {
1659
- throw new Error('header name must be a non-empty string');
1660
- }
1661
-
1662
- var key = findKey(self, lHeader);
1663
-
1664
- if (key && _rewrite !== true && (self[key] === false || _rewrite === false)) {
1665
- return;
1570
+ _createClass(AxiosHeaders, [{
1571
+ key: "set",
1572
+ value: function set(header, valueOrRewrite, rewrite) {
1573
+ var self = this;
1574
+ function setHeader(_value, _header, _rewrite) {
1575
+ var lHeader = normalizeHeader(_header);
1576
+ if (!lHeader) {
1577
+ throw new Error('header name must be a non-empty string');
1578
+ }
1579
+ var key = utils.findKey(self, lHeader);
1580
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1581
+ self[key || _header] = normalizeValue(_value);
1582
+ }
1666
1583
  }
1667
-
1668
- if (utils.isArray(_value)) {
1669
- _value = _value.map(normalizeValue);
1584
+ var setHeaders = function setHeaders(headers, _rewrite) {
1585
+ return utils.forEach(headers, function (_value, _header) {
1586
+ return setHeader(_value, _header, _rewrite);
1587
+ });
1588
+ };
1589
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
1590
+ setHeaders(header, valueOrRewrite);
1591
+ } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1592
+ setHeaders(parseHeaders(header), valueOrRewrite);
1670
1593
  } else {
1671
- _value = normalizeValue(_value);
1594
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1672
1595
  }
1673
-
1674
- self[key || _header] = _value;
1675
- }
1676
-
1677
- if (utils.isPlainObject(header)) {
1678
- utils.forEach(header, function (_value, _header) {
1679
- setHeader(_value, _header, valueOrRewrite);
1680
- });
1681
- } else {
1682
- setHeader(valueOrRewrite, header, rewrite);
1596
+ return this;
1683
1597
  }
1684
-
1685
- return this;
1686
- },
1687
- get: function get(header, parser) {
1688
- header = normalizeHeader(header);
1689
- if (!header) return undefined;
1690
- var key = findKey(this, header);
1691
-
1692
- if (key) {
1693
- var value = this[key];
1694
-
1695
- if (!parser) {
1696
- return value;
1598
+ }, {
1599
+ key: "get",
1600
+ value: function get(header, parser) {
1601
+ header = normalizeHeader(header);
1602
+ if (header) {
1603
+ var key = utils.findKey(this, header);
1604
+ if (key) {
1605
+ var value = this[key];
1606
+ if (!parser) {
1607
+ return value;
1608
+ }
1609
+ if (parser === true) {
1610
+ return parseTokens(value);
1611
+ }
1612
+ if (utils.isFunction(parser)) {
1613
+ return parser.call(this, value, key);
1614
+ }
1615
+ if (utils.isRegExp(parser)) {
1616
+ return parser.exec(value);
1617
+ }
1618
+ throw new TypeError('parser must be boolean|regexp|function');
1619
+ }
1697
1620
  }
1698
-
1699
- if (parser === true) {
1700
- return parseTokens(value);
1621
+ }
1622
+ }, {
1623
+ key: "has",
1624
+ value: function has(header, matcher) {
1625
+ header = normalizeHeader(header);
1626
+ if (header) {
1627
+ var key = utils.findKey(this, header);
1628
+ return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1701
1629
  }
1702
-
1703
- if (utils.isFunction(parser)) {
1704
- return parser.call(this, value, key);
1630
+ return false;
1631
+ }
1632
+ }, {
1633
+ key: "delete",
1634
+ value: function _delete(header, matcher) {
1635
+ var self = this;
1636
+ var deleted = false;
1637
+ function deleteHeader(_header) {
1638
+ _header = normalizeHeader(_header);
1639
+ if (_header) {
1640
+ var key = utils.findKey(self, _header);
1641
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1642
+ delete self[key];
1643
+ deleted = true;
1644
+ }
1645
+ }
1705
1646
  }
1706
-
1707
- if (utils.isRegExp(parser)) {
1708
- return parser.exec(value);
1647
+ if (utils.isArray(header)) {
1648
+ header.forEach(deleteHeader);
1649
+ } else {
1650
+ deleteHeader(header);
1709
1651
  }
1710
-
1711
- throw new TypeError('parser must be boolean|regexp|function');
1652
+ return deleted;
1712
1653
  }
1713
- },
1714
- has: function has(header, matcher) {
1715
- header = normalizeHeader(header);
1716
-
1717
- if (header) {
1718
- var key = findKey(this, header);
1719
- return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1654
+ }, {
1655
+ key: "clear",
1656
+ value: function clear() {
1657
+ return Object.keys(this).forEach(this["delete"].bind(this));
1720
1658
  }
1721
-
1722
- return false;
1723
- },
1724
- "delete": function _delete(header, matcher) {
1725
- var self = this;
1726
- var deleted = false;
1727
-
1728
- function deleteHeader(_header) {
1729
- _header = normalizeHeader(_header);
1730
-
1731
- if (_header) {
1732
- var key = findKey(self, _header);
1733
-
1734
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1735
- delete self[key];
1736
- deleted = true;
1659
+ }, {
1660
+ key: "normalize",
1661
+ value: function normalize(format) {
1662
+ var self = this;
1663
+ var headers = {};
1664
+ utils.forEach(this, function (value, header) {
1665
+ var key = utils.findKey(headers, header);
1666
+ if (key) {
1667
+ self[key] = normalizeValue(value);
1668
+ delete self[header];
1669
+ return;
1737
1670
  }
1671
+ var normalized = format ? formatHeader(header) : String(header).trim();
1672
+ if (normalized !== header) {
1673
+ delete self[header];
1674
+ }
1675
+ self[normalized] = normalizeValue(value);
1676
+ headers[normalized] = true;
1677
+ });
1678
+ return this;
1679
+ }
1680
+ }, {
1681
+ key: "concat",
1682
+ value: function concat() {
1683
+ var _this$constructor;
1684
+ for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
1685
+ targets[_key] = arguments[_key];
1738
1686
  }
1687
+ return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
1739
1688
  }
1740
-
1741
- if (utils.isArray(header)) {
1742
- header.forEach(deleteHeader);
1743
- } else {
1744
- deleteHeader(header);
1689
+ }, {
1690
+ key: "toJSON",
1691
+ value: function toJSON(asStrings) {
1692
+ var obj = Object.create(null);
1693
+ utils.forEach(this, function (value, header) {
1694
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1695
+ });
1696
+ return obj;
1745
1697
  }
1746
-
1747
- return deleted;
1748
- },
1749
- clear: function clear() {
1750
- return Object.keys(this).forEach(this["delete"].bind(this));
1751
- },
1752
- normalize: function normalize(format) {
1753
- var self = this;
1754
- var headers = {};
1755
- utils.forEach(this, function (value, header) {
1756
- var key = findKey(headers, header);
1757
-
1758
- if (key) {
1759
- self[key] = normalizeValue(value);
1760
- delete self[header];
1761
- return;
1762
- }
1763
-
1764
- var normalized = format ? formatHeader(header) : String(header).trim();
1765
-
1766
- if (normalized !== header) {
1767
- delete self[header];
1698
+ }, {
1699
+ key: _Symbol$iterator,
1700
+ value: function value() {
1701
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1702
+ }
1703
+ }, {
1704
+ key: "toString",
1705
+ value: function toString() {
1706
+ return Object.entries(this.toJSON()).map(function (_ref) {
1707
+ var _ref2 = _slicedToArray(_ref, 2),
1708
+ header = _ref2[0],
1709
+ value = _ref2[1];
1710
+ return header + ': ' + value;
1711
+ }).join('\n');
1712
+ }
1713
+ }, {
1714
+ key: _Symbol$toStringTag,
1715
+ get: function get() {
1716
+ return 'AxiosHeaders';
1717
+ }
1718
+ }], [{
1719
+ key: "from",
1720
+ value: function from(thing) {
1721
+ return thing instanceof this ? thing : new this(thing);
1722
+ }
1723
+ }, {
1724
+ key: "concat",
1725
+ value: function concat(first) {
1726
+ var computed = new this(first);
1727
+ for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1728
+ targets[_key2 - 1] = arguments[_key2];
1768
1729
  }
1769
-
1770
- self[normalized] = normalizeValue(value);
1771
- headers[normalized] = true;
1772
- });
1773
- return this;
1774
- },
1775
- toJSON: function toJSON() {
1776
- var obj = Object.create(null);
1777
- utils.forEach(Object.assign({}, this[$defaults] || null, this), function (value, header) {
1778
- if (value == null || value === false) return;
1779
- obj[header] = utils.isArray(value) ? value.join(', ') : value;
1780
- });
1781
- return obj;
1782
- }
1783
- });
1784
- Object.assign(AxiosHeaders, {
1785
- from: function from(thing) {
1786
- if (utils.isString(thing)) {
1787
- return new this(parseHeaders(thing));
1730
+ targets.forEach(function (target) {
1731
+ return computed.set(target);
1732
+ });
1733
+ return computed;
1788
1734
  }
1789
-
1790
- return thing instanceof this ? thing : new this(thing);
1791
- },
1792
- accessor: function accessor(header) {
1793
- var internals = this[$internals] = this[$internals] = {
1794
- accessors: {}
1795
- };
1796
- var accessors = internals.accessors;
1797
- var prototype = this.prototype;
1798
-
1799
- function defineAccessor(_header) {
1800
- var lHeader = normalizeHeader(_header);
1801
-
1802
- if (!accessors[lHeader]) {
1803
- buildAccessors(prototype, _header);
1804
- accessors[lHeader] = true;
1735
+ }, {
1736
+ key: "accessor",
1737
+ value: function accessor(header) {
1738
+ var internals = this[$internals] = this[$internals] = {
1739
+ accessors: {}
1740
+ };
1741
+ var accessors = internals.accessors;
1742
+ var prototype = this.prototype;
1743
+ function defineAccessor(_header) {
1744
+ var lHeader = normalizeHeader(_header);
1745
+ if (!accessors[lHeader]) {
1746
+ buildAccessors(prototype, _header);
1747
+ accessors[lHeader] = true;
1748
+ }
1805
1749
  }
1750
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1751
+ return this;
1806
1752
  }
1807
-
1808
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1809
- return this;
1810
- }
1811
- });
1753
+ }]);
1754
+ return AxiosHeaders;
1755
+ }(Symbol.iterator, Symbol.toStringTag);
1812
1756
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
1813
1757
  utils.freezeMethods(AxiosHeaders.prototype);
1814
1758
  utils.freezeMethods(AxiosHeaders);
1759
+ var AxiosHeaders$1 = AxiosHeaders;
1815
1760
 
1816
1761
  /**
1817
1762
  * Calculate data maxRate
@@ -1819,7 +1764,6 @@
1819
1764
  * @param {Number} [min= 1000]
1820
1765
  * @returns {Function}
1821
1766
  */
1822
-
1823
1767
  function speedometer(samplesCount, min) {
1824
1768
  samplesCount = samplesCount || 10;
1825
1769
  var bytes = new Array(samplesCount);
@@ -1831,31 +1775,24 @@
1831
1775
  return function push(chunkLength) {
1832
1776
  var now = Date.now();
1833
1777
  var startedAt = timestamps[tail];
1834
-
1835
1778
  if (!firstSampleTS) {
1836
1779
  firstSampleTS = now;
1837
1780
  }
1838
-
1839
1781
  bytes[head] = chunkLength;
1840
1782
  timestamps[head] = now;
1841
1783
  var i = tail;
1842
1784
  var bytesCount = 0;
1843
-
1844
1785
  while (i !== head) {
1845
1786
  bytesCount += bytes[i++];
1846
1787
  i = i % samplesCount;
1847
1788
  }
1848
-
1849
1789
  head = (head + 1) % samplesCount;
1850
-
1851
1790
  if (head === tail) {
1852
1791
  tail = (tail + 1) % samplesCount;
1853
1792
  }
1854
-
1855
1793
  if (now - firstSampleTS < min) {
1856
1794
  return;
1857
1795
  }
1858
-
1859
1796
  var passed = startedAt && now - startedAt;
1860
1797
  return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
1861
1798
  };
@@ -1863,16 +1800,12 @@
1863
1800
 
1864
1801
  function progressEventReducer(listener, isDownloadStream) {
1865
1802
  var bytesNotified = 0;
1866
-
1867
1803
  var _speedometer = speedometer(50, 250);
1868
-
1869
1804
  return function (e) {
1870
1805
  var loaded = e.loaded;
1871
1806
  var total = e.lengthComputable ? e.total : undefined;
1872
1807
  var progressBytes = loaded - bytesNotified;
1873
-
1874
1808
  var rate = _speedometer(progressBytes);
1875
-
1876
1809
  var inRange = loaded <= total;
1877
1810
  bytesNotified = loaded;
1878
1811
  var data = {
@@ -1881,54 +1814,50 @@
1881
1814
  progress: total ? loaded / total : undefined,
1882
1815
  bytes: progressBytes,
1883
1816
  rate: rate ? rate : undefined,
1884
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined
1817
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
1818
+ event: e
1885
1819
  };
1886
1820
  data[isDownloadStream ? 'download' : 'upload'] = true;
1887
1821
  listener(data);
1888
1822
  };
1889
1823
  }
1890
-
1891
1824
  function xhrAdapter(config) {
1892
1825
  return new Promise(function dispatchXhrRequest(resolve, reject) {
1893
1826
  var requestData = config.data;
1894
- var requestHeaders = AxiosHeaders.from(config.headers).normalize();
1827
+ var requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
1895
1828
  var responseType = config.responseType;
1896
1829
  var onCanceled;
1897
-
1898
1830
  function done() {
1899
1831
  if (config.cancelToken) {
1900
1832
  config.cancelToken.unsubscribe(onCanceled);
1901
1833
  }
1902
-
1903
1834
  if (config.signal) {
1904
1835
  config.signal.removeEventListener('abort', onCanceled);
1905
1836
  }
1906
1837
  }
1907
-
1908
1838
  if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
1909
1839
  requestHeaders.setContentType(false); // Let the browser set it
1910
1840
  }
1911
1841
 
1912
- var request = new XMLHttpRequest(); // HTTP basic authentication
1842
+ var request = new XMLHttpRequest();
1913
1843
 
1844
+ // HTTP basic authentication
1914
1845
  if (config.auth) {
1915
1846
  var username = config.auth.username || '';
1916
1847
  var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1917
1848
  requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
1918
1849
  }
1919
-
1920
1850
  var fullPath = buildFullPath(config.baseURL, config.url);
1921
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); // Set the request timeout in MS
1851
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
1922
1852
 
1853
+ // Set the request timeout in MS
1923
1854
  request.timeout = config.timeout;
1924
-
1925
1855
  function onloadend() {
1926
1856
  if (!request) {
1927
1857
  return;
1928
- } // Prepare the response
1929
-
1930
-
1931
- var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
1858
+ }
1859
+ // Prepare the response
1860
+ var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
1932
1861
  var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
1933
1862
  var response = {
1934
1863
  data: responseData,
@@ -1944,11 +1873,11 @@
1944
1873
  }, function _reject(err) {
1945
1874
  reject(err);
1946
1875
  done();
1947
- }, response); // Clean up request
1876
+ }, response);
1948
1877
 
1878
+ // Clean up request
1949
1879
  request = null;
1950
1880
  }
1951
-
1952
1881
  if ('onloadend' in request) {
1953
1882
  // Use onloadend if available
1954
1883
  request.onloadend = onloadend;
@@ -1957,97 +1886,95 @@
1957
1886
  request.onreadystatechange = function handleLoad() {
1958
1887
  if (!request || request.readyState !== 4) {
1959
1888
  return;
1960
- } // The request errored out and we didn't get a response, this will be
1889
+ }
1890
+
1891
+ // The request errored out and we didn't get a response, this will be
1961
1892
  // handled by onerror instead
1962
1893
  // With one exception: request that using file: protocol, most browsers
1963
1894
  // will return status as 0 even though it's a successful request
1964
-
1965
-
1966
1895
  if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
1967
1896
  return;
1968
- } // readystate handler is calling before onerror or ontimeout handlers,
1897
+ }
1898
+ // readystate handler is calling before onerror or ontimeout handlers,
1969
1899
  // so we should call onloadend on the next 'tick'
1970
-
1971
-
1972
1900
  setTimeout(onloadend);
1973
1901
  };
1974
- } // Handle browser request cancellation (as opposed to a manual cancellation)
1975
-
1902
+ }
1976
1903
 
1904
+ // Handle browser request cancellation (as opposed to a manual cancellation)
1977
1905
  request.onabort = function handleAbort() {
1978
1906
  if (!request) {
1979
1907
  return;
1980
1908
  }
1909
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
1981
1910
 
1982
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); // Clean up request
1983
-
1911
+ // Clean up request
1984
1912
  request = null;
1985
- }; // Handle low level network errors
1986
-
1913
+ };
1987
1914
 
1915
+ // Handle low level network errors
1988
1916
  request.onerror = function handleError() {
1989
1917
  // Real errors are hidden from us by the browser
1990
1918
  // onerror should only fire if it's a network error
1991
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request)); // Clean up request
1919
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
1992
1920
 
1921
+ // Clean up request
1993
1922
  request = null;
1994
- }; // Handle timeout
1995
-
1923
+ };
1996
1924
 
1925
+ // Handle timeout
1997
1926
  request.ontimeout = function handleTimeout() {
1998
1927
  var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1999
1928
  var transitional = config.transitional || transitionalDefaults;
2000
-
2001
1929
  if (config.timeoutErrorMessage) {
2002
1930
  timeoutErrorMessage = config.timeoutErrorMessage;
2003
1931
  }
1932
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
2004
1933
 
2005
- reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request)); // Clean up request
2006
-
1934
+ // Clean up request
2007
1935
  request = null;
2008
- }; // Add xsrf header
1936
+ };
1937
+
1938
+ // Add xsrf header
2009
1939
  // This is only done if running in a standard browser environment.
2010
1940
  // Specifically not if we're in a web worker, or react-native.
2011
-
2012
-
2013
1941
  if (platform.isStandardBrowserEnv) {
2014
1942
  // Add xsrf header
2015
1943
  var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2016
-
2017
1944
  if (xsrfValue) {
2018
1945
  requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2019
1946
  }
2020
- } // Remove Content-Type if data is undefined
2021
-
1947
+ }
2022
1948
 
2023
- requestData === undefined && requestHeaders.setContentType(null); // Add headers to the request
1949
+ // Remove Content-Type if data is undefined
1950
+ requestData === undefined && requestHeaders.setContentType(null);
2024
1951
 
1952
+ // Add headers to the request
2025
1953
  if ('setRequestHeader' in request) {
2026
1954
  utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2027
1955
  request.setRequestHeader(key, val);
2028
1956
  });
2029
- } // Add withCredentials to request if needed
2030
-
1957
+ }
2031
1958
 
1959
+ // Add withCredentials to request if needed
2032
1960
  if (!utils.isUndefined(config.withCredentials)) {
2033
1961
  request.withCredentials = !!config.withCredentials;
2034
- } // Add responseType to request if needed
2035
-
1962
+ }
2036
1963
 
1964
+ // Add responseType to request if needed
2037
1965
  if (responseType && responseType !== 'json') {
2038
1966
  request.responseType = config.responseType;
2039
- } // Handle progress if needed
2040
-
1967
+ }
2041
1968
 
1969
+ // Handle progress if needed
2042
1970
  if (typeof config.onDownloadProgress === 'function') {
2043
1971
  request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2044
- } // Not all browsers support upload events
2045
-
1972
+ }
2046
1973
 
1974
+ // Not all browsers support upload events
2047
1975
  if (typeof config.onUploadProgress === 'function' && request.upload) {
2048
1976
  request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2049
1977
  }
2050
-
2051
1978
  if (config.cancelToken || config.signal) {
2052
1979
  // Handle cancellation
2053
1980
  // eslint-disable-next-line func-names
@@ -2055,27 +1982,22 @@
2055
1982
  if (!request) {
2056
1983
  return;
2057
1984
  }
2058
-
2059
1985
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2060
1986
  request.abort();
2061
1987
  request = null;
2062
1988
  };
2063
-
2064
1989
  config.cancelToken && config.cancelToken.subscribe(onCanceled);
2065
-
2066
1990
  if (config.signal) {
2067
1991
  config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2068
1992
  }
2069
1993
  }
2070
-
2071
1994
  var protocol = parseProtocol(fullPath);
2072
-
2073
1995
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
2074
1996
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2075
1997
  return;
2076
- } // Send the request
2077
-
1998
+ }
2078
1999
 
2000
+ // Send the request
2079
2001
  request.send(requestData || null);
2080
2002
  });
2081
2003
  }
@@ -2088,36 +2010,31 @@
2088
2010
  getAdapter: function getAdapter(nameOrAdapter) {
2089
2011
  if (utils.isString(nameOrAdapter)) {
2090
2012
  var adapter = adapters[nameOrAdapter];
2091
-
2092
2013
  if (!nameOrAdapter) {
2093
2014
  throw Error(utils.hasOwnProp(nameOrAdapter) ? "Adapter '".concat(nameOrAdapter, "' is not available in the build") : "Can not resolve adapter '".concat(nameOrAdapter, "'"));
2094
2015
  }
2095
-
2096
2016
  return adapter;
2097
2017
  }
2098
-
2099
2018
  if (!utils.isFunction(nameOrAdapter)) {
2100
2019
  throw new TypeError('adapter is not a function');
2101
2020
  }
2102
-
2103
2021
  return nameOrAdapter;
2104
2022
  },
2105
2023
  adapters: adapters
2106
2024
  };
2107
2025
 
2108
2026
  var DEFAULT_CONTENT_TYPE = {
2109
- 'Content-Type': 'application/x-www-form-urlencoded'
2027
+ 'Content-Type': undefined
2110
2028
  };
2029
+
2111
2030
  /**
2112
2031
  * If the browser has an XMLHttpRequest object, use the XHR adapter, otherwise use the HTTP
2113
2032
  * adapter
2114
2033
  *
2115
2034
  * @returns {Function}
2116
2035
  */
2117
-
2118
2036
  function getDefaultAdapter() {
2119
2037
  var adapter;
2120
-
2121
2038
  if (typeof XMLHttpRequest !== 'undefined') {
2122
2039
  // For browsers use XHR adapter
2123
2040
  adapter = adapters$1.getAdapter('xhr');
@@ -2125,9 +2042,9 @@
2125
2042
  // For node use HTTP adapter
2126
2043
  adapter = adapters$1.getAdapter('http');
2127
2044
  }
2128
-
2129
2045
  return adapter;
2130
2046
  }
2047
+
2131
2048
  /**
2132
2049
  * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2133
2050
  * of the input
@@ -2138,8 +2055,6 @@
2138
2055
  *
2139
2056
  * @returns {string} A stringified version of the rawValue.
2140
2057
  */
2141
-
2142
-
2143
2058
  function stringifySafely(rawValue, parser, encoder) {
2144
2059
  if (utils.isString(rawValue)) {
2145
2060
  try {
@@ -2151,10 +2066,8 @@
2151
2066
  }
2152
2067
  }
2153
2068
  }
2154
-
2155
2069
  return (encoder || JSON.stringify)(rawValue);
2156
2070
  }
2157
-
2158
2071
  var defaults = {
2159
2072
  transitional: transitionalDefaults,
2160
2073
  adapter: getDefaultAdapter(),
@@ -2162,66 +2075,51 @@
2162
2075
  var contentType = headers.getContentType() || '';
2163
2076
  var hasJSONContentType = contentType.indexOf('application/json') > -1;
2164
2077
  var isObjectPayload = utils.isObject(data);
2165
-
2166
2078
  if (isObjectPayload && utils.isHTMLForm(data)) {
2167
2079
  data = new FormData(data);
2168
2080
  }
2169
-
2170
2081
  var isFormData = utils.isFormData(data);
2171
-
2172
2082
  if (isFormData) {
2173
2083
  if (!hasJSONContentType) {
2174
2084
  return data;
2175
2085
  }
2176
-
2177
2086
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2178
2087
  }
2179
-
2180
2088
  if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
2181
2089
  return data;
2182
2090
  }
2183
-
2184
2091
  if (utils.isArrayBufferView(data)) {
2185
2092
  return data.buffer;
2186
2093
  }
2187
-
2188
2094
  if (utils.isURLSearchParams(data)) {
2189
2095
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2190
2096
  return data.toString();
2191
2097
  }
2192
-
2193
2098
  var isFileList;
2194
-
2195
2099
  if (isObjectPayload) {
2196
2100
  if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2197
2101
  return toURLEncodedForm(data, this.formSerializer).toString();
2198
2102
  }
2199
-
2200
2103
  if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2201
2104
  var _FormData = this.env && this.env.FormData;
2202
-
2203
2105
  return toFormData(isFileList ? {
2204
2106
  'files[]': data
2205
2107
  } : data, _FormData && new _FormData(), this.formSerializer);
2206
2108
  }
2207
2109
  }
2208
-
2209
2110
  if (isObjectPayload || hasJSONContentType) {
2210
2111
  headers.setContentType('application/json', false);
2211
2112
  return stringifySafely(data);
2212
2113
  }
2213
-
2214
2114
  return data;
2215
2115
  }],
2216
2116
  transformResponse: [function transformResponse(data) {
2217
2117
  var transitional = this.transitional || defaults.transitional;
2218
2118
  var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2219
2119
  var JSONRequested = this.responseType === 'json';
2220
-
2221
2120
  if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2222
2121
  var silentJSONParsing = transitional && transitional.silentJSONParsing;
2223
2122
  var strictJSONParsing = !silentJSONParsing && JSONRequested;
2224
-
2225
2123
  try {
2226
2124
  return JSON.parse(data);
2227
2125
  } catch (e) {
@@ -2229,15 +2127,12 @@
2229
2127
  if (e.name === 'SyntaxError') {
2230
2128
  throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
2231
2129
  }
2232
-
2233
2130
  throw e;
2234
2131
  }
2235
2132
  }
2236
2133
  }
2237
-
2238
2134
  return data;
2239
2135
  }],
2240
-
2241
2136
  /**
2242
2137
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
2243
2138
  * timeout is not created.
@@ -2266,6 +2161,7 @@
2266
2161
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2267
2162
  defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
2268
2163
  });
2164
+ var defaults$1 = defaults;
2269
2165
 
2270
2166
  /**
2271
2167
  * Transform the data for a request or a response
@@ -2275,11 +2171,10 @@
2275
2171
  *
2276
2172
  * @returns {*} The resulting transformed data
2277
2173
  */
2278
-
2279
2174
  function transformData(fns, response) {
2280
- var config = this || defaults;
2175
+ var config = this || defaults$1;
2281
2176
  var context = response || config;
2282
- var headers = AxiosHeaders.from(context.headers);
2177
+ var headers = AxiosHeaders$1.from(context.headers);
2283
2178
  var data = context.data;
2284
2179
  utils.forEach(fns, function transform(fn) {
2285
2180
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
@@ -2299,16 +2194,15 @@
2299
2194
  *
2300
2195
  * @returns {void}
2301
2196
  */
2302
-
2303
2197
  function throwIfCancellationRequested(config) {
2304
2198
  if (config.cancelToken) {
2305
2199
  config.cancelToken.throwIfRequested();
2306
2200
  }
2307
-
2308
2201
  if (config.signal && config.signal.aborted) {
2309
2202
  throw new CanceledError();
2310
2203
  }
2311
2204
  }
2205
+
2312
2206
  /**
2313
2207
  * Dispatch a request to the server using the configured adapter.
2314
2208
  *
@@ -2316,34 +2210,41 @@
2316
2210
  *
2317
2211
  * @returns {Promise} The Promise to be fulfilled
2318
2212
  */
2319
-
2320
-
2321
2213
  function dispatchRequest(config) {
2322
2214
  throwIfCancellationRequested(config);
2323
- config.headers = AxiosHeaders.from(config.headers); // Transform request data
2215
+ config.headers = AxiosHeaders$1.from(config.headers);
2324
2216
 
2217
+ // Transform request data
2325
2218
  config.data = transformData.call(config, config.transformRequest);
2326
- var adapter = config.adapter || defaults.adapter;
2219
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2220
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
2221
+ }
2222
+ var adapter = config.adapter || defaults$1.adapter;
2327
2223
  return adapter(config).then(function onAdapterResolution(response) {
2328
- throwIfCancellationRequested(config); // Transform response data
2224
+ throwIfCancellationRequested(config);
2329
2225
 
2226
+ // Transform response data
2330
2227
  response.data = transformData.call(config, config.transformResponse, response);
2331
- response.headers = AxiosHeaders.from(response.headers);
2228
+ response.headers = AxiosHeaders$1.from(response.headers);
2332
2229
  return response;
2333
2230
  }, function onAdapterRejection(reason) {
2334
2231
  if (!isCancel(reason)) {
2335
- throwIfCancellationRequested(config); // Transform response data
2232
+ throwIfCancellationRequested(config);
2336
2233
 
2234
+ // Transform response data
2337
2235
  if (reason && reason.response) {
2338
2236
  reason.response.data = transformData.call(config, config.transformResponse, reason.response);
2339
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
2237
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2340
2238
  }
2341
2239
  }
2342
-
2343
2240
  return Promise.reject(reason);
2344
2241
  });
2345
2242
  }
2346
2243
 
2244
+ var headersToObject = function headersToObject(thing) {
2245
+ return thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
2246
+ };
2247
+
2347
2248
  /**
2348
2249
  * Config-specific merge-function which creates a new config-object
2349
2250
  * by merging two configuration objects together.
@@ -2353,105 +2254,108 @@
2353
2254
  *
2354
2255
  * @returns {Object} New object resulting from merging config2 to config1
2355
2256
  */
2356
-
2357
2257
  function mergeConfig(config1, config2) {
2358
2258
  // eslint-disable-next-line no-param-reassign
2359
2259
  config2 = config2 || {};
2360
2260
  var config = {};
2361
-
2362
- function getMergedValue(target, source) {
2261
+ function getMergedValue(target, source, caseless) {
2363
2262
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2364
- return utils.merge(target, source);
2263
+ return utils.merge.call({
2264
+ caseless: caseless
2265
+ }, target, source);
2365
2266
  } else if (utils.isPlainObject(source)) {
2366
2267
  return utils.merge({}, source);
2367
2268
  } else if (utils.isArray(source)) {
2368
2269
  return source.slice();
2369
2270
  }
2370
-
2371
2271
  return source;
2372
- } // eslint-disable-next-line consistent-return
2373
-
2272
+ }
2374
2273
 
2375
- function mergeDeepProperties(prop) {
2376
- if (!utils.isUndefined(config2[prop])) {
2377
- return getMergedValue(config1[prop], config2[prop]);
2378
- } else if (!utils.isUndefined(config1[prop])) {
2379
- return getMergedValue(undefined, config1[prop]);
2274
+ // eslint-disable-next-line consistent-return
2275
+ function mergeDeepProperties(a, b, caseless) {
2276
+ if (!utils.isUndefined(b)) {
2277
+ return getMergedValue(a, b, caseless);
2278
+ } else if (!utils.isUndefined(a)) {
2279
+ return getMergedValue(undefined, a, caseless);
2380
2280
  }
2381
- } // eslint-disable-next-line consistent-return
2382
-
2281
+ }
2383
2282
 
2384
- function valueFromConfig2(prop) {
2385
- if (!utils.isUndefined(config2[prop])) {
2386
- return getMergedValue(undefined, config2[prop]);
2283
+ // eslint-disable-next-line consistent-return
2284
+ function valueFromConfig2(a, b) {
2285
+ if (!utils.isUndefined(b)) {
2286
+ return getMergedValue(undefined, b);
2387
2287
  }
2388
- } // eslint-disable-next-line consistent-return
2389
-
2288
+ }
2390
2289
 
2391
- function defaultToConfig2(prop) {
2392
- if (!utils.isUndefined(config2[prop])) {
2393
- return getMergedValue(undefined, config2[prop]);
2394
- } else if (!utils.isUndefined(config1[prop])) {
2395
- return getMergedValue(undefined, config1[prop]);
2290
+ // eslint-disable-next-line consistent-return
2291
+ function defaultToConfig2(a, b) {
2292
+ if (!utils.isUndefined(b)) {
2293
+ return getMergedValue(undefined, b);
2294
+ } else if (!utils.isUndefined(a)) {
2295
+ return getMergedValue(undefined, a);
2396
2296
  }
2397
- } // eslint-disable-next-line consistent-return
2398
-
2297
+ }
2399
2298
 
2400
- function mergeDirectKeys(prop) {
2299
+ // eslint-disable-next-line consistent-return
2300
+ function mergeDirectKeys(a, b, prop) {
2401
2301
  if (prop in config2) {
2402
- return getMergedValue(config1[prop], config2[prop]);
2302
+ return getMergedValue(a, b);
2403
2303
  } else if (prop in config1) {
2404
- return getMergedValue(undefined, config1[prop]);
2304
+ return getMergedValue(undefined, a);
2405
2305
  }
2406
2306
  }
2407
-
2408
2307
  var mergeMap = {
2409
- 'url': valueFromConfig2,
2410
- 'method': valueFromConfig2,
2411
- 'data': valueFromConfig2,
2412
- 'baseURL': defaultToConfig2,
2413
- 'transformRequest': defaultToConfig2,
2414
- 'transformResponse': defaultToConfig2,
2415
- 'paramsSerializer': defaultToConfig2,
2416
- 'timeout': defaultToConfig2,
2417
- 'timeoutMessage': defaultToConfig2,
2418
- 'withCredentials': defaultToConfig2,
2419
- 'adapter': defaultToConfig2,
2420
- 'responseType': defaultToConfig2,
2421
- 'xsrfCookieName': defaultToConfig2,
2422
- 'xsrfHeaderName': defaultToConfig2,
2423
- 'onUploadProgress': defaultToConfig2,
2424
- 'onDownloadProgress': defaultToConfig2,
2425
- 'decompress': defaultToConfig2,
2426
- 'maxContentLength': defaultToConfig2,
2427
- 'maxBodyLength': defaultToConfig2,
2428
- 'beforeRedirect': defaultToConfig2,
2429
- 'transport': defaultToConfig2,
2430
- 'httpAgent': defaultToConfig2,
2431
- 'httpsAgent': defaultToConfig2,
2432
- 'cancelToken': defaultToConfig2,
2433
- 'socketPath': defaultToConfig2,
2434
- 'responseEncoding': defaultToConfig2,
2435
- 'validateStatus': mergeDirectKeys
2308
+ url: valueFromConfig2,
2309
+ method: valueFromConfig2,
2310
+ data: valueFromConfig2,
2311
+ baseURL: defaultToConfig2,
2312
+ transformRequest: defaultToConfig2,
2313
+ transformResponse: defaultToConfig2,
2314
+ paramsSerializer: defaultToConfig2,
2315
+ timeout: defaultToConfig2,
2316
+ timeoutMessage: defaultToConfig2,
2317
+ withCredentials: defaultToConfig2,
2318
+ adapter: defaultToConfig2,
2319
+ responseType: defaultToConfig2,
2320
+ xsrfCookieName: defaultToConfig2,
2321
+ xsrfHeaderName: defaultToConfig2,
2322
+ onUploadProgress: defaultToConfig2,
2323
+ onDownloadProgress: defaultToConfig2,
2324
+ decompress: defaultToConfig2,
2325
+ maxContentLength: defaultToConfig2,
2326
+ maxBodyLength: defaultToConfig2,
2327
+ beforeRedirect: defaultToConfig2,
2328
+ transport: defaultToConfig2,
2329
+ httpAgent: defaultToConfig2,
2330
+ httpsAgent: defaultToConfig2,
2331
+ cancelToken: defaultToConfig2,
2332
+ socketPath: defaultToConfig2,
2333
+ responseEncoding: defaultToConfig2,
2334
+ validateStatus: mergeDirectKeys,
2335
+ headers: function headers(a, b) {
2336
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
2337
+ }
2436
2338
  };
2437
2339
  utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2438
2340
  var merge = mergeMap[prop] || mergeDeepProperties;
2439
- var configValue = merge(prop);
2341
+ var configValue = merge(config1[prop], config2[prop], prop);
2440
2342
  utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2441
2343
  });
2442
2344
  return config;
2443
2345
  }
2444
2346
 
2445
- var VERSION = "1.1.2";
2347
+ var VERSION = "1.2.0-alpha.1";
2446
2348
 
2447
- var validators$1 = {}; // eslint-disable-next-line func-names
2349
+ var validators$1 = {};
2448
2350
 
2351
+ // eslint-disable-next-line func-names
2449
2352
  ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) {
2450
2353
  validators$1[type] = function validator(thing) {
2451
2354
  return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2452
2355
  };
2453
2356
  });
2454
2357
  var deprecatedWarnings = {};
2358
+
2455
2359
  /**
2456
2360
  * Transitional option validator
2457
2361
  *
@@ -2461,27 +2365,25 @@
2461
2365
  *
2462
2366
  * @returns {function}
2463
2367
  */
2464
-
2465
2368
  validators$1.transitional = function transitional(validator, version, message) {
2466
2369
  function formatMessage(opt, desc) {
2467
2370
  return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2468
- } // eslint-disable-next-line func-names
2469
-
2371
+ }
2470
2372
 
2373
+ // eslint-disable-next-line func-names
2471
2374
  return function (value, opt, opts) {
2472
2375
  if (validator === false) {
2473
2376
  throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
2474
2377
  }
2475
-
2476
2378
  if (version && !deprecatedWarnings[opt]) {
2477
- deprecatedWarnings[opt] = true; // eslint-disable-next-line no-console
2478
-
2379
+ deprecatedWarnings[opt] = true;
2380
+ // eslint-disable-next-line no-console
2479
2381
  console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
2480
2382
  }
2481
-
2482
2383
  return validator ? validator(value, opt, opts) : true;
2483
2384
  };
2484
2385
  };
2386
+
2485
2387
  /**
2486
2388
  * Assert object's properties type
2487
2389
  *
@@ -2492,42 +2394,35 @@
2492
2394
  * @returns {object}
2493
2395
  */
2494
2396
 
2495
-
2496
2397
  function assertOptions(options, schema, allowUnknown) {
2497
2398
  if (_typeof(options) !== 'object') {
2498
2399
  throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2499
2400
  }
2500
-
2501
2401
  var keys = Object.keys(options);
2502
2402
  var i = keys.length;
2503
-
2504
2403
  while (i-- > 0) {
2505
2404
  var opt = keys[i];
2506
2405
  var validator = schema[opt];
2507
-
2508
2406
  if (validator) {
2509
2407
  var value = options[opt];
2510
2408
  var result = value === undefined || validator(value, opt, options);
2511
-
2512
2409
  if (result !== true) {
2513
2410
  throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2514
2411
  }
2515
-
2516
2412
  continue;
2517
2413
  }
2518
-
2519
2414
  if (allowUnknown !== true) {
2520
2415
  throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2521
2416
  }
2522
2417
  }
2523
2418
  }
2524
-
2525
2419
  var validator = {
2526
2420
  assertOptions: assertOptions,
2527
2421
  validators: validators$1
2528
2422
  };
2529
2423
 
2530
2424
  var validators = validator.validators;
2425
+
2531
2426
  /**
2532
2427
  * Create a new instance of Axios
2533
2428
  *
@@ -2535,17 +2430,16 @@
2535
2430
  *
2536
2431
  * @return {Axios} A new instance of Axios
2537
2432
  */
2538
-
2539
2433
  var Axios = /*#__PURE__*/function () {
2540
2434
  function Axios(instanceConfig) {
2541
2435
  _classCallCheck(this, Axios);
2542
-
2543
2436
  this.defaults = instanceConfig;
2544
2437
  this.interceptors = {
2545
- request: new InterceptorManager(),
2546
- response: new InterceptorManager()
2438
+ request: new InterceptorManager$1(),
2439
+ response: new InterceptorManager$1()
2547
2440
  };
2548
2441
  }
2442
+
2549
2443
  /**
2550
2444
  * Dispatch a request
2551
2445
  *
@@ -2554,8 +2448,6 @@
2554
2448
  *
2555
2449
  * @returns {Promise} The Promise to be fulfilled
2556
2450
  */
2557
-
2558
-
2559
2451
  _createClass(Axios, [{
2560
2452
  key: "request",
2561
2453
  value: function request(configOrUrl, config) {
@@ -2567,34 +2459,43 @@
2567
2459
  } else {
2568
2460
  config = configOrUrl || {};
2569
2461
  }
2570
-
2571
2462
  config = mergeConfig(this.defaults, config);
2572
- var transitional = config.transitional;
2573
-
2463
+ var _config = config,
2464
+ transitional = _config.transitional,
2465
+ paramsSerializer = _config.paramsSerializer,
2466
+ headers = _config.headers;
2574
2467
  if (transitional !== undefined) {
2575
2468
  validator.assertOptions(transitional, {
2576
2469
  silentJSONParsing: validators.transitional(validators["boolean"]),
2577
2470
  forcedJSONParsing: validators.transitional(validators["boolean"]),
2578
2471
  clarifyTimeoutError: validators.transitional(validators["boolean"])
2579
2472
  }, false);
2580
- } // Set config.method
2581
-
2473
+ }
2474
+ if (paramsSerializer !== undefined) {
2475
+ validator.assertOptions(paramsSerializer, {
2476
+ encode: validators["function"],
2477
+ serialize: validators["function"]
2478
+ }, true);
2479
+ }
2582
2480
 
2583
- config.method = (config.method || this.defaults.method || 'get').toLowerCase(); // Flatten headers
2481
+ // Set config.method
2482
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2483
+ var contextHeaders;
2584
2484
 
2585
- var defaultHeaders = config.headers && utils.merge(config.headers.common, config.headers[config.method]);
2586
- defaultHeaders && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
2587
- delete config.headers[method];
2485
+ // Flatten headers
2486
+ contextHeaders = headers && utils.merge(headers.common, headers[config.method]);
2487
+ contextHeaders && utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
2488
+ delete headers[method];
2588
2489
  });
2589
- config.headers = new AxiosHeaders(config.headers, defaultHeaders); // filter out skipped interceptors
2490
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2590
2491
 
2492
+ // filter out skipped interceptors
2591
2493
  var requestInterceptorChain = [];
2592
2494
  var synchronousRequestInterceptors = true;
2593
2495
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2594
2496
  if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2595
2497
  return;
2596
2498
  }
2597
-
2598
2499
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2599
2500
  requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2600
2501
  });
@@ -2605,29 +2506,23 @@
2605
2506
  var promise;
2606
2507
  var i = 0;
2607
2508
  var len;
2608
-
2609
2509
  if (!synchronousRequestInterceptors) {
2610
2510
  var chain = [dispatchRequest.bind(this), undefined];
2611
2511
  chain.unshift.apply(chain, requestInterceptorChain);
2612
2512
  chain.push.apply(chain, responseInterceptorChain);
2613
2513
  len = chain.length;
2614
2514
  promise = Promise.resolve(config);
2615
-
2616
2515
  while (i < len) {
2617
2516
  promise = promise.then(chain[i++], chain[i++]);
2618
2517
  }
2619
-
2620
2518
  return promise;
2621
2519
  }
2622
-
2623
2520
  len = requestInterceptorChain.length;
2624
2521
  var newConfig = config;
2625
2522
  i = 0;
2626
-
2627
2523
  while (i < len) {
2628
2524
  var onFulfilled = requestInterceptorChain[i++];
2629
2525
  var onRejected = requestInterceptorChain[i++];
2630
-
2631
2526
  try {
2632
2527
  newConfig = onFulfilled(newConfig);
2633
2528
  } catch (error) {
@@ -2635,20 +2530,16 @@
2635
2530
  break;
2636
2531
  }
2637
2532
  }
2638
-
2639
2533
  try {
2640
2534
  promise = dispatchRequest.call(this, newConfig);
2641
2535
  } catch (error) {
2642
2536
  return Promise.reject(error);
2643
2537
  }
2644
-
2645
2538
  i = 0;
2646
2539
  len = responseInterceptorChain.length;
2647
-
2648
2540
  while (i < len) {
2649
2541
  promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2650
2542
  }
2651
-
2652
2543
  return promise;
2653
2544
  }
2654
2545
  }, {
@@ -2659,11 +2550,8 @@
2659
2550
  return buildURL(fullPath, config.params, config.paramsSerializer);
2660
2551
  }
2661
2552
  }]);
2662
-
2663
2553
  return Axios;
2664
2554
  }(); // Provide aliases for supported request methods
2665
-
2666
-
2667
2555
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2668
2556
  /*eslint func-names:0*/
2669
2557
  Axios.prototype[method] = function (url, config) {
@@ -2676,6 +2564,7 @@
2676
2564
  });
2677
2565
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2678
2566
  /*eslint func-names:0*/
2567
+
2679
2568
  function generateHTTPMethod(isForm) {
2680
2569
  return function httpMethod(url, data, config) {
2681
2570
  return this.request(mergeConfig(config || {}, {
@@ -2688,10 +2577,10 @@
2688
2577
  }));
2689
2578
  };
2690
2579
  }
2691
-
2692
2580
  Axios.prototype[method] = generateHTTPMethod();
2693
2581
  Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2694
2582
  });
2583
+ var Axios$1 = Axios;
2695
2584
 
2696
2585
  /**
2697
2586
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -2700,63 +2589,54 @@
2700
2589
  *
2701
2590
  * @returns {CancelToken}
2702
2591
  */
2703
-
2704
2592
  var CancelToken = /*#__PURE__*/function () {
2705
2593
  function CancelToken(executor) {
2706
2594
  _classCallCheck(this, CancelToken);
2707
-
2708
2595
  if (typeof executor !== 'function') {
2709
2596
  throw new TypeError('executor must be a function.');
2710
2597
  }
2711
-
2712
2598
  var resolvePromise;
2713
2599
  this.promise = new Promise(function promiseExecutor(resolve) {
2714
2600
  resolvePromise = resolve;
2715
2601
  });
2716
- var token = this; // eslint-disable-next-line func-names
2602
+ var token = this;
2717
2603
 
2604
+ // eslint-disable-next-line func-names
2718
2605
  this.promise.then(function (cancel) {
2719
2606
  if (!token._listeners) return;
2720
2607
  var i = token._listeners.length;
2721
-
2722
2608
  while (i-- > 0) {
2723
2609
  token._listeners[i](cancel);
2724
2610
  }
2725
-
2726
2611
  token._listeners = null;
2727
- }); // eslint-disable-next-line func-names
2612
+ });
2728
2613
 
2614
+ // eslint-disable-next-line func-names
2729
2615
  this.promise.then = function (onfulfilled) {
2730
- var _resolve; // eslint-disable-next-line func-names
2731
-
2732
-
2616
+ var _resolve;
2617
+ // eslint-disable-next-line func-names
2733
2618
  var promise = new Promise(function (resolve) {
2734
2619
  token.subscribe(resolve);
2735
2620
  _resolve = resolve;
2736
2621
  }).then(onfulfilled);
2737
-
2738
2622
  promise.cancel = function reject() {
2739
2623
  token.unsubscribe(_resolve);
2740
2624
  };
2741
-
2742
2625
  return promise;
2743
2626
  };
2744
-
2745
2627
  executor(function cancel(message, config, request) {
2746
2628
  if (token.reason) {
2747
2629
  // Cancellation has already been requested
2748
2630
  return;
2749
2631
  }
2750
-
2751
2632
  token.reason = new CanceledError(message, config, request);
2752
2633
  resolvePromise(token.reason);
2753
2634
  });
2754
2635
  }
2636
+
2755
2637
  /**
2756
2638
  * Throws a `CanceledError` if cancellation has been requested.
2757
2639
  */
2758
-
2759
-
2760
2640
  _createClass(CancelToken, [{
2761
2641
  key: "throwIfRequested",
2762
2642
  value: function throwIfRequested() {
@@ -2764,10 +2644,10 @@
2764
2644
  throw this.reason;
2765
2645
  }
2766
2646
  }
2647
+
2767
2648
  /**
2768
2649
  * Subscribe to the cancel signal
2769
2650
  */
2770
-
2771
2651
  }, {
2772
2652
  key: "subscribe",
2773
2653
  value: function subscribe(listener) {
@@ -2775,35 +2655,32 @@
2775
2655
  listener(this.reason);
2776
2656
  return;
2777
2657
  }
2778
-
2779
2658
  if (this._listeners) {
2780
2659
  this._listeners.push(listener);
2781
2660
  } else {
2782
2661
  this._listeners = [listener];
2783
2662
  }
2784
2663
  }
2664
+
2785
2665
  /**
2786
2666
  * Unsubscribe from the cancel signal
2787
2667
  */
2788
-
2789
2668
  }, {
2790
2669
  key: "unsubscribe",
2791
2670
  value: function unsubscribe(listener) {
2792
2671
  if (!this._listeners) {
2793
2672
  return;
2794
2673
  }
2795
-
2796
2674
  var index = this._listeners.indexOf(listener);
2797
-
2798
2675
  if (index !== -1) {
2799
2676
  this._listeners.splice(index, 1);
2800
2677
  }
2801
2678
  }
2679
+
2802
2680
  /**
2803
2681
  * Returns an object that contains a new `CancelToken` and a function that, when called,
2804
2682
  * cancels the `CancelToken`.
2805
2683
  */
2806
-
2807
2684
  }], [{
2808
2685
  key: "source",
2809
2686
  value: function source() {
@@ -2817,9 +2694,9 @@
2817
2694
  };
2818
2695
  }
2819
2696
  }]);
2820
-
2821
2697
  return CancelToken;
2822
2698
  }();
2699
+ var CancelToken$1 = CancelToken;
2823
2700
 
2824
2701
  /**
2825
2702
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -2842,7 +2719,6 @@
2842
2719
  *
2843
2720
  * @returns {Function}
2844
2721
  */
2845
-
2846
2722
  function spread(callback) {
2847
2723
  return function wrap(arr) {
2848
2724
  return callback.apply(null, arr);
@@ -2856,7 +2732,6 @@
2856
2732
  *
2857
2733
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
2858
2734
  */
2859
-
2860
2735
  function isAxiosError(payload) {
2861
2736
  return utils.isObject(payload) && payload.isAxiosError === true;
2862
2737
  }
@@ -2868,52 +2743,59 @@
2868
2743
  *
2869
2744
  * @returns {Axios} A new instance of Axios
2870
2745
  */
2871
-
2872
2746
  function createInstance(defaultConfig) {
2873
- var context = new Axios(defaultConfig);
2874
- var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance
2747
+ var context = new Axios$1(defaultConfig);
2748
+ var instance = bind(Axios$1.prototype.request, context);
2875
2749
 
2876
- utils.extend(instance, Axios.prototype, context, {
2750
+ // Copy axios.prototype to instance
2751
+ utils.extend(instance, Axios$1.prototype, context, {
2877
2752
  allOwnKeys: true
2878
- }); // Copy context to instance
2753
+ });
2879
2754
 
2755
+ // Copy context to instance
2880
2756
  utils.extend(instance, context, null, {
2881
2757
  allOwnKeys: true
2882
- }); // Factory for creating new instances
2758
+ });
2883
2759
 
2760
+ // Factory for creating new instances
2884
2761
  instance.create = function create(instanceConfig) {
2885
2762
  return createInstance(mergeConfig(defaultConfig, instanceConfig));
2886
2763
  };
2887
-
2888
2764
  return instance;
2889
- } // Create the default instance to be exported
2890
-
2765
+ }
2891
2766
 
2892
- var axios = createInstance(defaults); // Expose Axios class to allow class inheritance
2767
+ // Create the default instance to be exported
2768
+ var axios = createInstance(defaults$1);
2893
2769
 
2894
- axios.Axios = Axios; // Expose Cancel & CancelToken
2770
+ // Expose Axios class to allow class inheritance
2771
+ axios.Axios = Axios$1;
2895
2772
 
2773
+ // Expose Cancel & CancelToken
2896
2774
  axios.CanceledError = CanceledError;
2897
- axios.CancelToken = CancelToken;
2775
+ axios.CancelToken = CancelToken$1;
2898
2776
  axios.isCancel = isCancel;
2899
2777
  axios.VERSION = VERSION;
2900
- axios.toFormData = toFormData; // Expose AxiosError class
2778
+ axios.toFormData = toFormData;
2901
2779
 
2902
- axios.AxiosError = AxiosError; // alias for CanceledError for backward compatibility
2780
+ // Expose AxiosError class
2781
+ axios.AxiosError = AxiosError;
2903
2782
 
2904
- axios.Cancel = axios.CanceledError; // Expose all/spread
2783
+ // alias for CanceledError for backward compatibility
2784
+ axios.Cancel = axios.CanceledError;
2905
2785
 
2786
+ // Expose all/spread
2906
2787
  axios.all = function all(promises) {
2907
2788
  return Promise.all(promises);
2908
2789
  };
2790
+ axios.spread = spread;
2909
2791
 
2910
- axios.spread = spread; // Expose isAxiosError
2911
-
2792
+ // Expose isAxiosError
2912
2793
  axios.isAxiosError = isAxiosError;
2913
-
2794
+ axios.AxiosHeaders = AxiosHeaders$1;
2914
2795
  axios.formToJSON = function (thing) {
2915
2796
  return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
2916
2797
  };
2798
+ axios["default"] = axios;
2917
2799
 
2918
2800
  return axios;
2919
2801