axios 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +296 -43
- package/README.md +108 -19
- package/UPGRADE_GUIDE.md +1 -1
- package/dist/axios.js +170 -167
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +2 -2
- package/dist/axios.min.map +1 -1
- package/index.d.ts +10 -7
- package/lib/adapters/http.js +23 -15
- package/lib/adapters/xhr.js +3 -4
- package/lib/core/Axios.js +4 -3
- package/lib/core/enhanceError.js +1 -1
- package/lib/core/mergeConfig.js +46 -32
- package/lib/core/settle.js +1 -1
- package/lib/defaults.js +1 -0
- package/lib/helpers/buildURL.js +0 -1
- package/lib/helpers/isURLSameOrigin.js +0 -5
- package/lib/utils.js +36 -29
- package/package.json +4 -2
- package/lib/helpers/isValidXss.js +0 -7
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* axios v0.
|
1
|
+
/* axios v0.21.0 | (c) 2020 by Matt Zabriskie */
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
4
4
|
module.exports = factory();
|
@@ -66,7 +66,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
66
66
|
var utils = __webpack_require__(2);
|
67
67
|
var bind = __webpack_require__(3);
|
68
68
|
var Axios = __webpack_require__(4);
|
69
|
-
var mergeConfig = __webpack_require__(
|
69
|
+
var mergeConfig = __webpack_require__(22);
|
70
70
|
var defaults = __webpack_require__(10);
|
71
71
|
|
72
72
|
/**
|
@@ -100,15 +100,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
100
100
|
};
|
101
101
|
|
102
102
|
// Expose Cancel & CancelToken
|
103
|
-
axios.Cancel = __webpack_require__(
|
104
|
-
axios.CancelToken = __webpack_require__(
|
103
|
+
axios.Cancel = __webpack_require__(23);
|
104
|
+
axios.CancelToken = __webpack_require__(24);
|
105
105
|
axios.isCancel = __webpack_require__(9);
|
106
106
|
|
107
107
|
// Expose all/spread
|
108
108
|
axios.all = function all(promises) {
|
109
109
|
return Promise.all(promises);
|
110
110
|
};
|
111
|
-
axios.spread = __webpack_require__(
|
111
|
+
axios.spread = __webpack_require__(25);
|
112
112
|
|
113
113
|
module.exports = axios;
|
114
114
|
|
@@ -227,6 +227,21 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
227
227
|
return val !== null && typeof val === 'object';
|
228
228
|
}
|
229
229
|
|
230
|
+
/**
|
231
|
+
* Determine if a value is a plain Object
|
232
|
+
*
|
233
|
+
* @param {Object} val The value to test
|
234
|
+
* @return {boolean} True if value is a plain Object, otherwise false
|
235
|
+
*/
|
236
|
+
function isPlainObject(val) {
|
237
|
+
if (toString.call(val) !== '[object Object]') {
|
238
|
+
return false;
|
239
|
+
}
|
240
|
+
|
241
|
+
var prototype = Object.getPrototypeOf(val);
|
242
|
+
return prototype === null || prototype === Object.prototype;
|
243
|
+
}
|
244
|
+
|
230
245
|
/**
|
231
246
|
* Determine if a value is a Date
|
232
247
|
*
|
@@ -383,34 +398,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
383
398
|
function merge(/* obj1, obj2, obj3, ... */) {
|
384
399
|
var result = {};
|
385
400
|
function assignValue(val, key) {
|
386
|
-
if (
|
401
|
+
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
387
402
|
result[key] = merge(result[key], val);
|
388
|
-
} else {
|
389
|
-
result[key] = val;
|
390
|
-
}
|
391
|
-
|
392
|
-
|
393
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
394
|
-
forEach(arguments[i], assignValue);
|
395
|
-
}
|
396
|
-
return result;
|
397
|
-
}
|
398
|
-
|
399
|
-
/**
|
400
|
-
* Function equal to merge with the difference being that no reference
|
401
|
-
* to original objects is kept.
|
402
|
-
*
|
403
|
-
* @see merge
|
404
|
-
* @param {Object} obj1 Object to merge
|
405
|
-
* @returns {Object} Result of all merge properties
|
406
|
-
*/
|
407
|
-
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
408
|
-
var result = {};
|
409
|
-
function assignValue(val, key) {
|
410
|
-
if (typeof result[key] === 'object' && typeof val === 'object') {
|
411
|
-
result[key] = deepMerge(result[key], val);
|
412
|
-
} else if (typeof val === 'object') {
|
413
|
-
result[key] = deepMerge({}, val);
|
403
|
+
} else if (isPlainObject(val)) {
|
404
|
+
result[key] = merge({}, val);
|
405
|
+
} else if (isArray(val)) {
|
406
|
+
result[key] = val.slice();
|
414
407
|
} else {
|
415
408
|
result[key] = val;
|
416
409
|
}
|
@@ -441,6 +434,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
441
434
|
return a;
|
442
435
|
}
|
443
436
|
|
437
|
+
/**
|
438
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
439
|
+
*
|
440
|
+
* @param {string} content with BOM
|
441
|
+
* @return {string} content value without BOM
|
442
|
+
*/
|
443
|
+
function stripBOM(content) {
|
444
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
445
|
+
content = content.slice(1);
|
446
|
+
}
|
447
|
+
return content;
|
448
|
+
}
|
449
|
+
|
444
450
|
module.exports = {
|
445
451
|
isArray: isArray,
|
446
452
|
isArrayBuffer: isArrayBuffer,
|
@@ -450,6 +456,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
450
456
|
isString: isString,
|
451
457
|
isNumber: isNumber,
|
452
458
|
isObject: isObject,
|
459
|
+
isPlainObject: isPlainObject,
|
453
460
|
isUndefined: isUndefined,
|
454
461
|
isDate: isDate,
|
455
462
|
isFile: isFile,
|
@@ -460,9 +467,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
460
467
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
461
468
|
forEach: forEach,
|
462
469
|
merge: merge,
|
463
|
-
deepMerge: deepMerge,
|
464
470
|
extend: extend,
|
465
|
-
trim: trim
|
471
|
+
trim: trim,
|
472
|
+
stripBOM: stripBOM
|
466
473
|
};
|
467
474
|
|
468
475
|
|
@@ -493,7 +500,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
493
500
|
var buildURL = __webpack_require__(5);
|
494
501
|
var InterceptorManager = __webpack_require__(6);
|
495
502
|
var dispatchRequest = __webpack_require__(7);
|
496
|
-
var mergeConfig = __webpack_require__(
|
503
|
+
var mergeConfig = __webpack_require__(22);
|
497
504
|
|
498
505
|
/**
|
499
506
|
* Create a new instance of Axios
|
@@ -562,9 +569,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
562
569
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
563
570
|
/*eslint func-names:0*/
|
564
571
|
Axios.prototype[method] = function(url, config) {
|
565
|
-
return this.request(
|
572
|
+
return this.request(mergeConfig(config || {}, {
|
566
573
|
method: method,
|
567
|
-
url: url
|
574
|
+
url: url,
|
575
|
+
data: (config || {}).data
|
568
576
|
}));
|
569
577
|
};
|
570
578
|
});
|
@@ -572,7 +580,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
572
580
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
573
581
|
/*eslint func-names:0*/
|
574
582
|
Axios.prototype[method] = function(url, data, config) {
|
575
|
-
return this.request(
|
583
|
+
return this.request(mergeConfig(config || {}, {
|
576
584
|
method: method,
|
577
585
|
url: url,
|
578
586
|
data: data
|
@@ -593,7 +601,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
593
601
|
|
594
602
|
function encode(val) {
|
595
603
|
return encodeURIComponent(val).
|
596
|
-
replace(/%40/gi, '@').
|
597
604
|
replace(/%3A/gi, ':').
|
598
605
|
replace(/%24/g, '$').
|
599
606
|
replace(/%2C/gi, ',').
|
@@ -920,6 +927,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
920
927
|
xsrfHeaderName: 'X-XSRF-TOKEN',
|
921
928
|
|
922
929
|
maxContentLength: -1,
|
930
|
+
maxBodyLength: -1,
|
923
931
|
|
924
932
|
validateStatus: function validateStatus(status) {
|
925
933
|
return status >= 200 && status < 300;
|
@@ -969,10 +977,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
969
977
|
|
970
978
|
var utils = __webpack_require__(2);
|
971
979
|
var settle = __webpack_require__(13);
|
980
|
+
var cookies = __webpack_require__(16);
|
972
981
|
var buildURL = __webpack_require__(5);
|
973
|
-
var buildFullPath = __webpack_require__(
|
974
|
-
var parseHeaders = __webpack_require__(
|
975
|
-
var isURLSameOrigin = __webpack_require__(
|
982
|
+
var buildFullPath = __webpack_require__(17);
|
983
|
+
var parseHeaders = __webpack_require__(20);
|
984
|
+
var isURLSameOrigin = __webpack_require__(21);
|
976
985
|
var createError = __webpack_require__(14);
|
977
986
|
|
978
987
|
module.exports = function xhrAdapter(config) {
|
@@ -989,7 +998,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
989
998
|
// HTTP basic authentication
|
990
999
|
if (config.auth) {
|
991
1000
|
var username = config.auth.username || '';
|
992
|
-
var password = config.auth.password
|
1001
|
+
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
993
1002
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
994
1003
|
}
|
995
1004
|
|
@@ -1070,8 +1079,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1070
1079
|
// This is only done if running in a standard browser environment.
|
1071
1080
|
// Specifically not if we're in a web worker, or react-native.
|
1072
1081
|
if (utils.isStandardBrowserEnv()) {
|
1073
|
-
var cookies = __webpack_require__(22);
|
1074
|
-
|
1075
1082
|
// Add xsrf header
|
1076
1083
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
1077
1084
|
cookies.read(config.xsrfCookieName) :
|
@@ -1137,7 +1144,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1137
1144
|
});
|
1138
1145
|
}
|
1139
1146
|
|
1140
|
-
if (requestData
|
1147
|
+
if (!requestData) {
|
1141
1148
|
requestData = null;
|
1142
1149
|
}
|
1143
1150
|
|
@@ -1164,7 +1171,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1164
1171
|
*/
|
1165
1172
|
module.exports = function settle(resolve, reject, response) {
|
1166
1173
|
var validateStatus = response.config.validateStatus;
|
1167
|
-
if (!validateStatus || validateStatus(response.status)) {
|
1174
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1168
1175
|
resolve(response);
|
1169
1176
|
} else {
|
1170
1177
|
reject(createError(
|
@@ -1228,7 +1235,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1228
1235
|
error.response = response;
|
1229
1236
|
error.isAxiosError = true;
|
1230
1237
|
|
1231
|
-
error.toJSON = function() {
|
1238
|
+
error.toJSON = function toJSON() {
|
1232
1239
|
return {
|
1233
1240
|
// Standard
|
1234
1241
|
message: this.message,
|
@@ -1256,8 +1263,67 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1256
1263
|
|
1257
1264
|
'use strict';
|
1258
1265
|
|
1259
|
-
var
|
1260
|
-
|
1266
|
+
var utils = __webpack_require__(2);
|
1267
|
+
|
1268
|
+
module.exports = (
|
1269
|
+
utils.isStandardBrowserEnv() ?
|
1270
|
+
|
1271
|
+
// Standard browser envs support document.cookie
|
1272
|
+
(function standardBrowserEnv() {
|
1273
|
+
return {
|
1274
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1275
|
+
var cookie = [];
|
1276
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
1277
|
+
|
1278
|
+
if (utils.isNumber(expires)) {
|
1279
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
if (utils.isString(path)) {
|
1283
|
+
cookie.push('path=' + path);
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
if (utils.isString(domain)) {
|
1287
|
+
cookie.push('domain=' + domain);
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
if (secure === true) {
|
1291
|
+
cookie.push('secure');
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
document.cookie = cookie.join('; ');
|
1295
|
+
},
|
1296
|
+
|
1297
|
+
read: function read(name) {
|
1298
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1299
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1300
|
+
},
|
1301
|
+
|
1302
|
+
remove: function remove(name) {
|
1303
|
+
this.write(name, '', Date.now() - 86400000);
|
1304
|
+
}
|
1305
|
+
};
|
1306
|
+
})() :
|
1307
|
+
|
1308
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
1309
|
+
(function nonStandardBrowserEnv() {
|
1310
|
+
return {
|
1311
|
+
write: function write() {},
|
1312
|
+
read: function read() { return null; },
|
1313
|
+
remove: function remove() {}
|
1314
|
+
};
|
1315
|
+
})()
|
1316
|
+
);
|
1317
|
+
|
1318
|
+
|
1319
|
+
/***/ }),
|
1320
|
+
/* 17 */
|
1321
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1322
|
+
|
1323
|
+
'use strict';
|
1324
|
+
|
1325
|
+
var isAbsoluteURL = __webpack_require__(18);
|
1326
|
+
var combineURLs = __webpack_require__(19);
|
1261
1327
|
|
1262
1328
|
/**
|
1263
1329
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
@@ -1277,7 +1343,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1277
1343
|
|
1278
1344
|
|
1279
1345
|
/***/ }),
|
1280
|
-
/*
|
1346
|
+
/* 18 */
|
1281
1347
|
/***/ (function(module, exports) {
|
1282
1348
|
|
1283
1349
|
'use strict';
|
@@ -1297,7 +1363,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1297
1363
|
|
1298
1364
|
|
1299
1365
|
/***/ }),
|
1300
|
-
/*
|
1366
|
+
/* 19 */
|
1301
1367
|
/***/ (function(module, exports) {
|
1302
1368
|
|
1303
1369
|
'use strict';
|
@@ -1317,7 +1383,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1317
1383
|
|
1318
1384
|
|
1319
1385
|
/***/ }),
|
1320
|
-
/*
|
1386
|
+
/* 20 */
|
1321
1387
|
/***/ (function(module, exports, __webpack_require__) {
|
1322
1388
|
|
1323
1389
|
'use strict';
|
@@ -1376,13 +1442,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1376
1442
|
|
1377
1443
|
|
1378
1444
|
/***/ }),
|
1379
|
-
/*
|
1445
|
+
/* 21 */
|
1380
1446
|
/***/ (function(module, exports, __webpack_require__) {
|
1381
1447
|
|
1382
1448
|
'use strict';
|
1383
1449
|
|
1384
1450
|
var utils = __webpack_require__(2);
|
1385
|
-
var isValidXss = __webpack_require__(21);
|
1386
1451
|
|
1387
1452
|
module.exports = (
|
1388
1453
|
utils.isStandardBrowserEnv() ?
|
@@ -1403,10 +1468,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1403
1468
|
function resolveURL(url) {
|
1404
1469
|
var href = url;
|
1405
1470
|
|
1406
|
-
if (isValidXss(url)) {
|
1407
|
-
throw new Error('URL contains XSS injection attempt');
|
1408
|
-
}
|
1409
|
-
|
1410
1471
|
if (msie) {
|
1411
1472
|
// IE needs attribute set twice to normalize properties
|
1412
1473
|
urlParsingNode.setAttribute('href', href);
|
@@ -1454,19 +1515,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1454
1515
|
);
|
1455
1516
|
|
1456
1517
|
|
1457
|
-
/***/ }),
|
1458
|
-
/* 21 */
|
1459
|
-
/***/ (function(module, exports) {
|
1460
|
-
|
1461
|
-
'use strict';
|
1462
|
-
|
1463
|
-
module.exports = function isValidXss(requestURL) {
|
1464
|
-
var xssRegex = /(\b)(on\w+)=|javascript|(<\s*)(\/*)script/gi;
|
1465
|
-
return xssRegex.test(requestURL);
|
1466
|
-
};
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
1518
|
/***/ }),
|
1471
1519
|
/* 22 */
|
1472
1520
|
/***/ (function(module, exports, __webpack_require__) {
|
@@ -1475,65 +1523,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1475
1523
|
|
1476
1524
|
var utils = __webpack_require__(2);
|
1477
1525
|
|
1478
|
-
module.exports = (
|
1479
|
-
utils.isStandardBrowserEnv() ?
|
1480
|
-
|
1481
|
-
// Standard browser envs support document.cookie
|
1482
|
-
(function standardBrowserEnv() {
|
1483
|
-
return {
|
1484
|
-
write: function write(name, value, expires, path, domain, secure) {
|
1485
|
-
var cookie = [];
|
1486
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
1487
|
-
|
1488
|
-
if (utils.isNumber(expires)) {
|
1489
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
1490
|
-
}
|
1491
|
-
|
1492
|
-
if (utils.isString(path)) {
|
1493
|
-
cookie.push('path=' + path);
|
1494
|
-
}
|
1495
|
-
|
1496
|
-
if (utils.isString(domain)) {
|
1497
|
-
cookie.push('domain=' + domain);
|
1498
|
-
}
|
1499
|
-
|
1500
|
-
if (secure === true) {
|
1501
|
-
cookie.push('secure');
|
1502
|
-
}
|
1503
|
-
|
1504
|
-
document.cookie = cookie.join('; ');
|
1505
|
-
},
|
1506
|
-
|
1507
|
-
read: function read(name) {
|
1508
|
-
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1509
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
1510
|
-
},
|
1511
|
-
|
1512
|
-
remove: function remove(name) {
|
1513
|
-
this.write(name, '', Date.now() - 86400000);
|
1514
|
-
}
|
1515
|
-
};
|
1516
|
-
})() :
|
1517
|
-
|
1518
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
1519
|
-
(function nonStandardBrowserEnv() {
|
1520
|
-
return {
|
1521
|
-
write: function write() {},
|
1522
|
-
read: function read() { return null; },
|
1523
|
-
remove: function remove() {}
|
1524
|
-
};
|
1525
|
-
})()
|
1526
|
-
);
|
1527
|
-
|
1528
|
-
|
1529
|
-
/***/ }),
|
1530
|
-
/* 23 */
|
1531
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1532
|
-
|
1533
|
-
'use strict';
|
1534
|
-
|
1535
|
-
var utils = __webpack_require__(2);
|
1536
|
-
|
1537
1526
|
/**
|
1538
1527
|
* Config-specific merge-function which creates a new config-object
|
1539
1528
|
* by merging two configuration objects together.
|
@@ -1547,66 +1536,80 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1547
1536
|
config2 = config2 || {};
|
1548
1537
|
var config = {};
|
1549
1538
|
|
1550
|
-
var valueFromConfig2Keys = ['url', 'method', '
|
1551
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
|
1539
|
+
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
1540
|
+
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
1552
1541
|
var defaultToConfig2Keys = [
|
1553
|
-
'baseURL', '
|
1554
|
-
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
1555
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
|
1556
|
-
'maxContentLength', '
|
1557
|
-
'httpsAgent', 'cancelToken', 'socketPath'
|
1542
|
+
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
1543
|
+
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
1544
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
1545
|
+
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
1546
|
+
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
1558
1547
|
];
|
1548
|
+
var directMergeKeys = ['validateStatus'];
|
1549
|
+
|
1550
|
+
function getMergedValue(target, source) {
|
1551
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
1552
|
+
return utils.merge(target, source);
|
1553
|
+
} else if (utils.isPlainObject(source)) {
|
1554
|
+
return utils.merge({}, source);
|
1555
|
+
} else if (utils.isArray(source)) {
|
1556
|
+
return source.slice();
|
1557
|
+
}
|
1558
|
+
return source;
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
function mergeDeepProperties(prop) {
|
1562
|
+
if (!utils.isUndefined(config2[prop])) {
|
1563
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
1564
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1565
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1566
|
+
}
|
1567
|
+
}
|
1559
1568
|
|
1560
1569
|
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
1561
|
-
if (
|
1562
|
-
config[prop] = config2[prop];
|
1570
|
+
if (!utils.isUndefined(config2[prop])) {
|
1571
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
1563
1572
|
}
|
1564
1573
|
});
|
1565
1574
|
|
1566
|
-
utils.forEach(mergeDeepPropertiesKeys,
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
config[prop] = config2[prop];
|
1571
|
-
} else if (utils.
|
1572
|
-
config[prop] =
|
1573
|
-
} else if (typeof config1[prop] !== 'undefined') {
|
1574
|
-
config[prop] = config1[prop];
|
1575
|
+
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
1576
|
+
|
1577
|
+
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
1578
|
+
if (!utils.isUndefined(config2[prop])) {
|
1579
|
+
config[prop] = getMergedValue(undefined, config2[prop]);
|
1580
|
+
} else if (!utils.isUndefined(config1[prop])) {
|
1581
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1575
1582
|
}
|
1576
1583
|
});
|
1577
1584
|
|
1578
|
-
utils.forEach(
|
1579
|
-
if (
|
1580
|
-
config[prop] = config2[prop];
|
1581
|
-
} else if (
|
1582
|
-
config[prop] = config1[prop];
|
1585
|
+
utils.forEach(directMergeKeys, function merge(prop) {
|
1586
|
+
if (prop in config2) {
|
1587
|
+
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
1588
|
+
} else if (prop in config1) {
|
1589
|
+
config[prop] = getMergedValue(undefined, config1[prop]);
|
1583
1590
|
}
|
1584
1591
|
});
|
1585
1592
|
|
1586
1593
|
var axiosKeys = valueFromConfig2Keys
|
1587
1594
|
.concat(mergeDeepPropertiesKeys)
|
1588
|
-
.concat(defaultToConfig2Keys)
|
1595
|
+
.concat(defaultToConfig2Keys)
|
1596
|
+
.concat(directMergeKeys);
|
1589
1597
|
|
1590
1598
|
var otherKeys = Object
|
1591
|
-
.keys(
|
1599
|
+
.keys(config1)
|
1600
|
+
.concat(Object.keys(config2))
|
1592
1601
|
.filter(function filterAxiosKeys(key) {
|
1593
1602
|
return axiosKeys.indexOf(key) === -1;
|
1594
1603
|
});
|
1595
1604
|
|
1596
|
-
utils.forEach(otherKeys,
|
1597
|
-
if (typeof config2[prop] !== 'undefined') {
|
1598
|
-
config[prop] = config2[prop];
|
1599
|
-
} else if (typeof config1[prop] !== 'undefined') {
|
1600
|
-
config[prop] = config1[prop];
|
1601
|
-
}
|
1602
|
-
});
|
1605
|
+
utils.forEach(otherKeys, mergeDeepProperties);
|
1603
1606
|
|
1604
1607
|
return config;
|
1605
1608
|
};
|
1606
1609
|
|
1607
1610
|
|
1608
1611
|
/***/ }),
|
1609
|
-
/*
|
1612
|
+
/* 23 */
|
1610
1613
|
/***/ (function(module, exports) {
|
1611
1614
|
|
1612
1615
|
'use strict';
|
@@ -1631,12 +1634,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1631
1634
|
|
1632
1635
|
|
1633
1636
|
/***/ }),
|
1634
|
-
/*
|
1637
|
+
/* 24 */
|
1635
1638
|
/***/ (function(module, exports, __webpack_require__) {
|
1636
1639
|
|
1637
1640
|
'use strict';
|
1638
1641
|
|
1639
|
-
var Cancel = __webpack_require__(
|
1642
|
+
var Cancel = __webpack_require__(23);
|
1640
1643
|
|
1641
1644
|
/**
|
1642
1645
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
@@ -1694,7 +1697,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1694
1697
|
|
1695
1698
|
|
1696
1699
|
/***/ }),
|
1697
|
-
/*
|
1700
|
+
/* 25 */
|
1698
1701
|
/***/ (function(module, exports) {
|
1699
1702
|
|
1700
1703
|
'use strict';
|