axios 0.16.2 → 0.18.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 v0.16.2 | (c) 2017 by Matt Zabriskie */
1
+ /* axios v0.18.1 | (c) 2019 by Matt Zabriskie */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -53,13 +53,13 @@ return /******/ (function(modules) { // webpackBootstrap
53
53
  /************************************************************************/
54
54
  /******/ ([
55
55
  /* 0 */
56
- /***/ function(module, exports, __webpack_require__) {
56
+ /***/ (function(module, exports, __webpack_require__) {
57
57
 
58
58
  module.exports = __webpack_require__(1);
59
59
 
60
- /***/ },
60
+ /***/ }),
61
61
  /* 1 */
62
- /***/ function(module, exports, __webpack_require__) {
62
+ /***/ (function(module, exports, __webpack_require__) {
63
63
 
64
64
  'use strict';
65
65
 
@@ -99,15 +99,15 @@ return /******/ (function(modules) { // webpackBootstrap
99
99
  };
100
100
 
101
101
  // Expose Cancel & CancelToken
102
- axios.Cancel = __webpack_require__(23);
103
- axios.CancelToken = __webpack_require__(24);
104
- axios.isCancel = __webpack_require__(20);
102
+ axios.Cancel = __webpack_require__(22);
103
+ axios.CancelToken = __webpack_require__(23);
104
+ axios.isCancel = __webpack_require__(19);
105
105
 
106
106
  // Expose all/spread
107
107
  axios.all = function all(promises) {
108
108
  return Promise.all(promises);
109
109
  };
110
- axios.spread = __webpack_require__(25);
110
+ axios.spread = __webpack_require__(24);
111
111
 
112
112
  module.exports = axios;
113
113
 
@@ -115,9 +115,9 @@ return /******/ (function(modules) { // webpackBootstrap
115
115
  module.exports.default = axios;
116
116
 
117
117
 
118
- /***/ },
118
+ /***/ }),
119
119
  /* 2 */
120
- /***/ function(module, exports, __webpack_require__) {
120
+ /***/ (function(module, exports, __webpack_require__) {
121
121
 
122
122
  'use strict';
123
123
 
@@ -328,7 +328,7 @@ return /******/ (function(modules) { // webpackBootstrap
328
328
  }
329
329
 
330
330
  // Force an array if not already something iterable
331
- if (typeof obj !== 'object' && !isArray(obj)) {
331
+ if (typeof obj !== 'object') {
332
332
  /*eslint no-param-reassign:0*/
333
333
  obj = [obj];
334
334
  }
@@ -424,9 +424,9 @@ return /******/ (function(modules) { // webpackBootstrap
424
424
  };
425
425
 
426
426
 
427
- /***/ },
427
+ /***/ }),
428
428
  /* 3 */
429
- /***/ function(module, exports) {
429
+ /***/ (function(module, exports) {
430
430
 
431
431
  'use strict';
432
432
 
@@ -441,45 +441,33 @@ return /******/ (function(modules) { // webpackBootstrap
441
441
  };
442
442
 
443
443
 
444
- /***/ },
444
+ /***/ }),
445
445
  /* 4 */
446
- /***/ function(module, exports) {
446
+ /***/ (function(module, exports) {
447
447
 
448
448
  /*!
449
449
  * Determine if an object is a Buffer
450
450
  *
451
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
451
+ * @author Feross Aboukhadijeh <https://feross.org>
452
452
  * @license MIT
453
453
  */
454
454
 
455
- // The _isBuffer check is for Safari 5-7 support, because it's missing
456
- // Object.prototype.constructor. Remove this eventually
457
- module.exports = function (obj) {
458
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
459
- }
460
-
461
- function isBuffer (obj) {
462
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
463
- }
464
-
465
- // For Node v0.10 support. Remove this eventually.
466
- function isSlowBuffer (obj) {
467
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
455
+ module.exports = function isBuffer (obj) {
456
+ return obj != null && obj.constructor != null &&
457
+ typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
468
458
  }
469
459
 
470
460
 
471
- /***/ },
461
+ /***/ }),
472
462
  /* 5 */
473
- /***/ function(module, exports, __webpack_require__) {
463
+ /***/ (function(module, exports, __webpack_require__) {
474
464
 
475
465
  'use strict';
476
466
 
477
467
  var defaults = __webpack_require__(6);
478
468
  var utils = __webpack_require__(2);
479
- var InterceptorManager = __webpack_require__(17);
480
- var dispatchRequest = __webpack_require__(18);
481
- var isAbsoluteURL = __webpack_require__(21);
482
- var combineURLs = __webpack_require__(22);
469
+ var InterceptorManager = __webpack_require__(16);
470
+ var dispatchRequest = __webpack_require__(17);
483
471
 
484
472
  /**
485
473
  * Create a new instance of Axios
@@ -508,14 +496,9 @@ return /******/ (function(modules) { // webpackBootstrap
508
496
  }, arguments[1]);
509
497
  }
510
498
 
511
- config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
499
+ config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
512
500
  config.method = config.method.toLowerCase();
513
501
 
514
- // Support baseURL config
515
- if (config.baseURL && !isAbsoluteURL(config.url)) {
516
- config.url = combineURLs(config.baseURL, config.url);
517
- }
518
-
519
502
  // Hook up interceptors middleware
520
503
  var chain = [dispatchRequest, undefined];
521
504
  var promise = Promise.resolve(config);
@@ -560,9 +543,9 @@ return /******/ (function(modules) { // webpackBootstrap
560
543
  module.exports = Axios;
561
544
 
562
545
 
563
- /***/ },
546
+ /***/ }),
564
547
  /* 6 */
565
- /***/ function(module, exports, __webpack_require__) {
548
+ /***/ (function(module, exports, __webpack_require__) {
566
549
 
567
550
  'use strict';
568
551
 
@@ -629,6 +612,10 @@ return /******/ (function(modules) { // webpackBootstrap
629
612
  return data;
630
613
  }],
631
614
 
615
+ /**
616
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
617
+ * timeout is not created.
618
+ */
632
619
  timeout: 0,
633
620
 
634
621
  xsrfCookieName: 'XSRF-TOKEN',
@@ -658,9 +645,9 @@ return /******/ (function(modules) { // webpackBootstrap
658
645
  module.exports = defaults;
659
646
 
660
647
 
661
- /***/ },
648
+ /***/ }),
662
649
  /* 7 */
663
- /***/ function(module, exports, __webpack_require__) {
650
+ /***/ (function(module, exports, __webpack_require__) {
664
651
 
665
652
  'use strict';
666
653
 
@@ -676,9 +663,9 @@ return /******/ (function(modules) { // webpackBootstrap
676
663
  };
677
664
 
678
665
 
679
- /***/ },
666
+ /***/ }),
680
667
  /* 8 */
681
- /***/ function(module, exports, __webpack_require__) {
668
+ /***/ (function(module, exports, __webpack_require__) {
682
669
 
683
670
  'use strict';
684
671
 
@@ -688,7 +675,6 @@ return /******/ (function(modules) { // webpackBootstrap
688
675
  var parseHeaders = __webpack_require__(13);
689
676
  var isURLSameOrigin = __webpack_require__(14);
690
677
  var createError = __webpack_require__(10);
691
- var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(15);
692
678
 
693
679
  module.exports = function xhrAdapter(config) {
694
680
  return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -700,22 +686,6 @@ return /******/ (function(modules) { // webpackBootstrap
700
686
  }
701
687
 
702
688
  var request = new XMLHttpRequest();
703
- var loadEvent = 'onreadystatechange';
704
- var xDomain = false;
705
-
706
- // For IE 8/9 CORS support
707
- // Only supports POST and GET calls and doesn't returns the response headers.
708
- // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
709
- if (("production") !== 'test' &&
710
- typeof window !== 'undefined' &&
711
- window.XDomainRequest && !('withCredentials' in request) &&
712
- !isURLSameOrigin(config.url)) {
713
- request = new window.XDomainRequest();
714
- loadEvent = 'onload';
715
- xDomain = true;
716
- request.onprogress = function handleProgress() {};
717
- request.ontimeout = function handleTimeout() {};
718
- }
719
689
 
720
690
  // HTTP basic authentication
721
691
  if (config.auth) {
@@ -730,8 +700,8 @@ return /******/ (function(modules) { // webpackBootstrap
730
700
  request.timeout = config.timeout;
731
701
 
732
702
  // Listen for ready state
733
- request[loadEvent] = function handleLoad() {
734
- if (!request || (request.readyState !== 4 && !xDomain)) {
703
+ request.onreadystatechange = function handleLoad() {
704
+ if (!request || request.readyState !== 4) {
735
705
  return;
736
706
  }
737
707
 
@@ -748,9 +718,8 @@ return /******/ (function(modules) { // webpackBootstrap
748
718
  var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
749
719
  var response = {
750
720
  data: responseData,
751
- // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
752
- status: request.status === 1223 ? 204 : request.status,
753
- statusText: request.status === 1223 ? 'No Content' : request.statusText,
721
+ status: request.status,
722
+ statusText: request.statusText,
754
723
  headers: responseHeaders,
755
724
  config: config,
756
725
  request: request
@@ -785,7 +754,7 @@ return /******/ (function(modules) { // webpackBootstrap
785
754
  // This is only done if running in a standard browser environment.
786
755
  // Specifically not if we're in a web worker, or react-native.
787
756
  if (utils.isStandardBrowserEnv()) {
788
- var cookies = __webpack_require__(16);
757
+ var cookies = __webpack_require__(15);
789
758
 
790
759
  // Add xsrf header
791
760
  var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
@@ -862,9 +831,9 @@ return /******/ (function(modules) { // webpackBootstrap
862
831
  };
863
832
 
864
833
 
865
- /***/ },
834
+ /***/ }),
866
835
  /* 9 */
867
- /***/ function(module, exports, __webpack_require__) {
836
+ /***/ (function(module, exports, __webpack_require__) {
868
837
 
869
838
  'use strict';
870
839
 
@@ -894,9 +863,9 @@ return /******/ (function(modules) { // webpackBootstrap
894
863
  };
895
864
 
896
865
 
897
- /***/ },
866
+ /***/ }),
898
867
  /* 10 */
899
- /***/ function(module, exports, __webpack_require__) {
868
+ /***/ (function(module, exports, __webpack_require__) {
900
869
 
901
870
  'use strict';
902
871
 
@@ -918,9 +887,9 @@ return /******/ (function(modules) { // webpackBootstrap
918
887
  };
919
888
 
920
889
 
921
- /***/ },
890
+ /***/ }),
922
891
  /* 11 */
923
- /***/ function(module, exports) {
892
+ /***/ (function(module, exports) {
924
893
 
925
894
  'use strict';
926
895
 
@@ -945,9 +914,9 @@ return /******/ (function(modules) { // webpackBootstrap
945
914
  };
946
915
 
947
916
 
948
- /***/ },
917
+ /***/ }),
949
918
  /* 12 */
950
- /***/ function(module, exports, __webpack_require__) {
919
+ /***/ (function(module, exports, __webpack_require__) {
951
920
 
952
921
  'use strict';
953
922
 
@@ -992,9 +961,7 @@ return /******/ (function(modules) { // webpackBootstrap
992
961
 
993
962
  if (utils.isArray(val)) {
994
963
  key = key + '[]';
995
- }
996
-
997
- if (!utils.isArray(val)) {
964
+ } else {
998
965
  val = [val];
999
966
  }
1000
967
 
@@ -1019,14 +986,23 @@ return /******/ (function(modules) { // webpackBootstrap
1019
986
  };
1020
987
 
1021
988
 
1022
- /***/ },
989
+ /***/ }),
1023
990
  /* 13 */
1024
- /***/ function(module, exports, __webpack_require__) {
991
+ /***/ (function(module, exports, __webpack_require__) {
1025
992
 
1026
993
  'use strict';
1027
994
 
1028
995
  var utils = __webpack_require__(2);
1029
996
 
997
+ // Headers whose duplicates are ignored by node
998
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
999
+ var ignoreDuplicateOf = [
1000
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1001
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1002
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1003
+ 'referer', 'retry-after', 'user-agent'
1004
+ ];
1005
+
1030
1006
  /**
1031
1007
  * Parse headers into an object
1032
1008
  *
@@ -1054,7 +1030,14 @@ return /******/ (function(modules) { // webpackBootstrap
1054
1030
  val = utils.trim(line.substr(i + 1));
1055
1031
 
1056
1032
  if (key) {
1057
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1033
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1034
+ return;
1035
+ }
1036
+ if (key === 'set-cookie') {
1037
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1038
+ } else {
1039
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1040
+ }
1058
1041
  }
1059
1042
  });
1060
1043
 
@@ -1062,9 +1045,9 @@ return /******/ (function(modules) { // webpackBootstrap
1062
1045
  };
1063
1046
 
1064
1047
 
1065
- /***/ },
1048
+ /***/ }),
1066
1049
  /* 14 */
1067
- /***/ function(module, exports, __webpack_require__) {
1050
+ /***/ (function(module, exports, __webpack_require__) {
1068
1051
 
1069
1052
  'use strict';
1070
1053
 
@@ -1136,51 +1119,9 @@ return /******/ (function(modules) { // webpackBootstrap
1136
1119
  );
1137
1120
 
1138
1121
 
1139
- /***/ },
1122
+ /***/ }),
1140
1123
  /* 15 */
1141
- /***/ function(module, exports) {
1142
-
1143
- 'use strict';
1144
-
1145
- // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
1146
-
1147
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
1148
-
1149
- function E() {
1150
- this.message = 'String contains an invalid character';
1151
- }
1152
- E.prototype = new Error;
1153
- E.prototype.code = 5;
1154
- E.prototype.name = 'InvalidCharacterError';
1155
-
1156
- function btoa(input) {
1157
- var str = String(input);
1158
- var output = '';
1159
- for (
1160
- // initialize result and counter
1161
- var block, charCode, idx = 0, map = chars;
1162
- // if the next str index does not exist:
1163
- // change the mapping table to "="
1164
- // check if d has no fractional digits
1165
- str.charAt(idx | 0) || (map = '=', idx % 1);
1166
- // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
1167
- output += map.charAt(63 & block >> 8 - idx % 1 * 8)
1168
- ) {
1169
- charCode = str.charCodeAt(idx += 3 / 4);
1170
- if (charCode > 0xFF) {
1171
- throw new E();
1172
- }
1173
- block = block << 8 | charCode;
1174
- }
1175
- return output;
1176
- }
1177
-
1178
- module.exports = btoa;
1179
-
1180
-
1181
- /***/ },
1182
- /* 16 */
1183
- /***/ function(module, exports, __webpack_require__) {
1124
+ /***/ (function(module, exports, __webpack_require__) {
1184
1125
 
1185
1126
  'use strict';
1186
1127
 
@@ -1237,9 +1178,9 @@ return /******/ (function(modules) { // webpackBootstrap
1237
1178
  );
1238
1179
 
1239
1180
 
1240
- /***/ },
1241
- /* 17 */
1242
- /***/ function(module, exports, __webpack_require__) {
1181
+ /***/ }),
1182
+ /* 16 */
1183
+ /***/ (function(module, exports, __webpack_require__) {
1243
1184
 
1244
1185
  'use strict';
1245
1186
 
@@ -1295,16 +1236,18 @@ return /******/ (function(modules) { // webpackBootstrap
1295
1236
  module.exports = InterceptorManager;
1296
1237
 
1297
1238
 
1298
- /***/ },
1299
- /* 18 */
1300
- /***/ function(module, exports, __webpack_require__) {
1239
+ /***/ }),
1240
+ /* 17 */
1241
+ /***/ (function(module, exports, __webpack_require__) {
1301
1242
 
1302
1243
  'use strict';
1303
1244
 
1304
1245
  var utils = __webpack_require__(2);
1305
- var transformData = __webpack_require__(19);
1306
- var isCancel = __webpack_require__(20);
1246
+ var transformData = __webpack_require__(18);
1247
+ var isCancel = __webpack_require__(19);
1307
1248
  var defaults = __webpack_require__(6);
1249
+ var isAbsoluteURL = __webpack_require__(20);
1250
+ var combineURLs = __webpack_require__(21);
1308
1251
 
1309
1252
  /**
1310
1253
  * Throws a `Cancel` if cancellation has been requested.
@@ -1324,6 +1267,11 @@ return /******/ (function(modules) { // webpackBootstrap
1324
1267
  module.exports = function dispatchRequest(config) {
1325
1268
  throwIfCancellationRequested(config);
1326
1269
 
1270
+ // Support baseURL config
1271
+ if (config.baseURL && !isAbsoluteURL(config.url)) {
1272
+ config.url = combineURLs(config.baseURL, config.url);
1273
+ }
1274
+
1327
1275
  // Ensure headers exist
1328
1276
  config.headers = config.headers || {};
1329
1277
 
@@ -1380,9 +1328,9 @@ return /******/ (function(modules) { // webpackBootstrap
1380
1328
  };
1381
1329
 
1382
1330
 
1383
- /***/ },
1384
- /* 19 */
1385
- /***/ function(module, exports, __webpack_require__) {
1331
+ /***/ }),
1332
+ /* 18 */
1333
+ /***/ (function(module, exports, __webpack_require__) {
1386
1334
 
1387
1335
  'use strict';
1388
1336
 
@@ -1406,9 +1354,9 @@ return /******/ (function(modules) { // webpackBootstrap
1406
1354
  };
1407
1355
 
1408
1356
 
1409
- /***/ },
1410
- /* 20 */
1411
- /***/ function(module, exports) {
1357
+ /***/ }),
1358
+ /* 19 */
1359
+ /***/ (function(module, exports) {
1412
1360
 
1413
1361
  'use strict';
1414
1362
 
@@ -1417,9 +1365,9 @@ return /******/ (function(modules) { // webpackBootstrap
1417
1365
  };
1418
1366
 
1419
1367
 
1420
- /***/ },
1421
- /* 21 */
1422
- /***/ function(module, exports) {
1368
+ /***/ }),
1369
+ /* 20 */
1370
+ /***/ (function(module, exports) {
1423
1371
 
1424
1372
  'use strict';
1425
1373
 
@@ -1437,9 +1385,9 @@ return /******/ (function(modules) { // webpackBootstrap
1437
1385
  };
1438
1386
 
1439
1387
 
1440
- /***/ },
1441
- /* 22 */
1442
- /***/ function(module, exports) {
1388
+ /***/ }),
1389
+ /* 21 */
1390
+ /***/ (function(module, exports) {
1443
1391
 
1444
1392
  'use strict';
1445
1393
 
@@ -1457,9 +1405,9 @@ return /******/ (function(modules) { // webpackBootstrap
1457
1405
  };
1458
1406
 
1459
1407
 
1460
- /***/ },
1461
- /* 23 */
1462
- /***/ function(module, exports) {
1408
+ /***/ }),
1409
+ /* 22 */
1410
+ /***/ (function(module, exports) {
1463
1411
 
1464
1412
  'use strict';
1465
1413
 
@@ -1482,13 +1430,13 @@ return /******/ (function(modules) { // webpackBootstrap
1482
1430
  module.exports = Cancel;
1483
1431
 
1484
1432
 
1485
- /***/ },
1486
- /* 24 */
1487
- /***/ function(module, exports, __webpack_require__) {
1433
+ /***/ }),
1434
+ /* 23 */
1435
+ /***/ (function(module, exports, __webpack_require__) {
1488
1436
 
1489
1437
  'use strict';
1490
1438
 
1491
- var Cancel = __webpack_require__(23);
1439
+ var Cancel = __webpack_require__(22);
1492
1440
 
1493
1441
  /**
1494
1442
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -1545,9 +1493,9 @@ return /******/ (function(modules) { // webpackBootstrap
1545
1493
  module.exports = CancelToken;
1546
1494
 
1547
1495
 
1548
- /***/ },
1549
- /* 25 */
1550
- /***/ function(module, exports) {
1496
+ /***/ }),
1497
+ /* 24 */
1498
+ /***/ (function(module, exports) {
1551
1499
 
1552
1500
  'use strict';
1553
1501
 
@@ -1578,7 +1526,7 @@ return /******/ (function(modules) { // webpackBootstrap
1578
1526
  };
1579
1527
 
1580
1528
 
1581
- /***/ }
1529
+ /***/ })
1582
1530
  /******/ ])
1583
1531
  });
1584
1532
  ;