axios 0.18.0 → 0.19.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/CHANGELOG.md +167 -3
- package/README.md +118 -34
- package/dist/axios.js +696 -566
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +2 -8
- package/dist/axios.min.map +1 -1
- package/index.d.ts +39 -13
- package/lib/adapters/http.js +73 -31
- package/lib/adapters/xhr.js +29 -29
- package/lib/axios.js +2 -1
- package/lib/core/Axios.js +21 -6
- package/lib/core/buildFullPath.js +20 -0
- package/lib/core/dispatchRequest.js +1 -8
- package/lib/core/enhanceError.js +21 -0
- package/lib/core/mergeConfig.js +73 -0
- package/lib/core/settle.js +1 -2
- package/lib/defaults.js +2 -1
- package/lib/helpers/buildURL.js +5 -0
- package/lib/helpers/cookies.js +41 -41
- package/lib/helpers/isURLSameOrigin.js +43 -38
- package/lib/helpers/isValidXss.js +7 -0
- package/lib/utils.js +53 -12
- package/package.json +22 -21
- package/lib/helpers/btoa.js +0 -36
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* axios v0.
|
1
|
+
/* axios v0.19.1 | (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();
|
@@ -65,8 +65,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
65
65
|
|
66
66
|
var utils = __webpack_require__(2);
|
67
67
|
var bind = __webpack_require__(3);
|
68
|
-
var Axios = __webpack_require__(
|
69
|
-
var
|
68
|
+
var Axios = __webpack_require__(4);
|
69
|
+
var mergeConfig = __webpack_require__(23);
|
70
|
+
var defaults = __webpack_require__(10);
|
70
71
|
|
71
72
|
/**
|
72
73
|
* Create an instance of Axios
|
@@ -95,19 +96,19 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
95
96
|
|
96
97
|
// Factory for creating new instances
|
97
98
|
axios.create = function create(instanceConfig) {
|
98
|
-
return createInstance(
|
99
|
+
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
99
100
|
};
|
100
101
|
|
101
102
|
// Expose Cancel & CancelToken
|
102
|
-
axios.Cancel = __webpack_require__(
|
103
|
-
axios.CancelToken = __webpack_require__(
|
104
|
-
axios.isCancel = __webpack_require__(
|
103
|
+
axios.Cancel = __webpack_require__(24);
|
104
|
+
axios.CancelToken = __webpack_require__(25);
|
105
|
+
axios.isCancel = __webpack_require__(9);
|
105
106
|
|
106
107
|
// Expose all/spread
|
107
108
|
axios.all = function all(promises) {
|
108
109
|
return Promise.all(promises);
|
109
110
|
};
|
110
|
-
axios.spread = __webpack_require__(
|
111
|
+
axios.spread = __webpack_require__(26);
|
111
112
|
|
112
113
|
module.exports = axios;
|
113
114
|
|
@@ -122,7 +123,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
122
123
|
'use strict';
|
123
124
|
|
124
125
|
var bind = __webpack_require__(3);
|
125
|
-
var isBuffer = __webpack_require__(4);
|
126
126
|
|
127
127
|
/*global toString:true*/
|
128
128
|
|
@@ -140,6 +140,27 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
140
140
|
return toString.call(val) === '[object Array]';
|
141
141
|
}
|
142
142
|
|
143
|
+
/**
|
144
|
+
* Determine if a value is undefined
|
145
|
+
*
|
146
|
+
* @param {Object} val The value to test
|
147
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
148
|
+
*/
|
149
|
+
function isUndefined(val) {
|
150
|
+
return typeof val === 'undefined';
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Determine if a value is a Buffer
|
155
|
+
*
|
156
|
+
* @param {Object} val The value to test
|
157
|
+
* @returns {boolean} True if value is a Buffer, otherwise false
|
158
|
+
*/
|
159
|
+
function isBuffer(val) {
|
160
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
161
|
+
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
162
|
+
}
|
163
|
+
|
143
164
|
/**
|
144
165
|
* Determine if a value is an ArrayBuffer
|
145
166
|
*
|
@@ -196,16 +217,6 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
196
217
|
return typeof val === 'number';
|
197
218
|
}
|
198
219
|
|
199
|
-
/**
|
200
|
-
* Determine if a value is undefined
|
201
|
-
*
|
202
|
-
* @param {Object} val The value to test
|
203
|
-
* @returns {boolean} True if the value is undefined, otherwise false
|
204
|
-
*/
|
205
|
-
function isUndefined(val) {
|
206
|
-
return typeof val === 'undefined';
|
207
|
-
}
|
208
|
-
|
209
220
|
/**
|
210
221
|
* Determine if a value is an Object
|
211
222
|
*
|
@@ -298,9 +309,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
298
309
|
*
|
299
310
|
* react-native:
|
300
311
|
* navigator.product -> 'ReactNative'
|
312
|
+
* nativescript
|
313
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
301
314
|
*/
|
302
315
|
function isStandardBrowserEnv() {
|
303
|
-
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
316
|
+
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
317
|
+
navigator.product === 'NativeScript' ||
|
318
|
+
navigator.product === 'NS')) {
|
304
319
|
return false;
|
305
320
|
}
|
306
321
|
return (
|
@@ -381,6 +396,32 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
381
396
|
return result;
|
382
397
|
}
|
383
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);
|
414
|
+
} else {
|
415
|
+
result[key] = val;
|
416
|
+
}
|
417
|
+
}
|
418
|
+
|
419
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
420
|
+
forEach(arguments[i], assignValue);
|
421
|
+
}
|
422
|
+
return result;
|
423
|
+
}
|
424
|
+
|
384
425
|
/**
|
385
426
|
* Extends object a by mutably adding to it the properties of object b.
|
386
427
|
*
|
@@ -419,6 +460,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
419
460
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
420
461
|
forEach: forEach,
|
421
462
|
merge: merge,
|
463
|
+
deepMerge: deepMerge,
|
422
464
|
extend: extend,
|
423
465
|
trim: trim
|
424
466
|
};
|
@@ -443,41 +485,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
443
485
|
|
444
486
|
/***/ }),
|
445
487
|
/* 4 */
|
446
|
-
/***/ (function(module, exports) {
|
447
|
-
|
448
|
-
/*!
|
449
|
-
* Determine if an object is a Buffer
|
450
|
-
*
|
451
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
452
|
-
* @license MIT
|
453
|
-
*/
|
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))
|
468
|
-
}
|
469
|
-
|
470
|
-
|
471
|
-
/***/ }),
|
472
|
-
/* 5 */
|
473
488
|
/***/ (function(module, exports, __webpack_require__) {
|
474
489
|
|
475
490
|
'use strict';
|
476
491
|
|
477
|
-
var defaults = __webpack_require__(6);
|
478
492
|
var utils = __webpack_require__(2);
|
479
|
-
var
|
480
|
-
var
|
493
|
+
var buildURL = __webpack_require__(5);
|
494
|
+
var InterceptorManager = __webpack_require__(6);
|
495
|
+
var dispatchRequest = __webpack_require__(7);
|
496
|
+
var mergeConfig = __webpack_require__(23);
|
481
497
|
|
482
498
|
/**
|
483
499
|
* Create a new instance of Axios
|
@@ -501,13 +517,22 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
501
517
|
/*eslint no-param-reassign:0*/
|
502
518
|
// Allow for axios('example/url'[, config]) a la fetch API
|
503
519
|
if (typeof config === 'string') {
|
504
|
-
config =
|
505
|
-
|
506
|
-
|
520
|
+
config = arguments[1] || {};
|
521
|
+
config.url = arguments[0];
|
522
|
+
} else {
|
523
|
+
config = config || {};
|
507
524
|
}
|
508
525
|
|
509
|
-
config =
|
510
|
-
|
526
|
+
config = mergeConfig(this.defaults, config);
|
527
|
+
|
528
|
+
// Set config.method
|
529
|
+
if (config.method) {
|
530
|
+
config.method = config.method.toLowerCase();
|
531
|
+
} else if (this.defaults.method) {
|
532
|
+
config.method = this.defaults.method.toLowerCase();
|
533
|
+
} else {
|
534
|
+
config.method = 'get';
|
535
|
+
}
|
511
536
|
|
512
537
|
// Hook up interceptors middleware
|
513
538
|
var chain = [dispatchRequest, undefined];
|
@@ -528,6 +553,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
528
553
|
return promise;
|
529
554
|
};
|
530
555
|
|
556
|
+
Axios.prototype.getUri = function getUri(config) {
|
557
|
+
config = mergeConfig(this.defaults, config);
|
558
|
+
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
559
|
+
};
|
560
|
+
|
531
561
|
// Provide aliases for supported request methods
|
532
562
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
533
563
|
/*eslint func-names:0*/
|
@@ -554,166 +584,408 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
554
584
|
|
555
585
|
|
556
586
|
/***/ }),
|
557
|
-
/*
|
587
|
+
/* 5 */
|
558
588
|
/***/ (function(module, exports, __webpack_require__) {
|
559
589
|
|
560
590
|
'use strict';
|
561
591
|
|
562
592
|
var utils = __webpack_require__(2);
|
563
|
-
var normalizeHeaderName = __webpack_require__(7);
|
564
|
-
|
565
|
-
var DEFAULT_CONTENT_TYPE = {
|
566
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
567
|
-
};
|
568
593
|
|
569
|
-
function
|
570
|
-
|
571
|
-
|
572
|
-
|
594
|
+
function encode(val) {
|
595
|
+
return encodeURIComponent(val).
|
596
|
+
replace(/%40/gi, '@').
|
597
|
+
replace(/%3A/gi, ':').
|
598
|
+
replace(/%24/g, '$').
|
599
|
+
replace(/%2C/gi, ',').
|
600
|
+
replace(/%20/g, '+').
|
601
|
+
replace(/%5B/gi, '[').
|
602
|
+
replace(/%5D/gi, ']');
|
573
603
|
}
|
574
604
|
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
605
|
+
/**
|
606
|
+
* Build a URL by appending params to the end
|
607
|
+
*
|
608
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
609
|
+
* @param {object} [params] The params to be appended
|
610
|
+
* @returns {string} The formatted url
|
611
|
+
*/
|
612
|
+
module.exports = function buildURL(url, params, paramsSerializer) {
|
613
|
+
/*eslint no-param-reassign:0*/
|
614
|
+
if (!params) {
|
615
|
+
return url;
|
583
616
|
}
|
584
|
-
return adapter;
|
585
|
-
}
|
586
617
|
|
587
|
-
|
588
|
-
|
618
|
+
var serializedParams;
|
619
|
+
if (paramsSerializer) {
|
620
|
+
serializedParams = paramsSerializer(params);
|
621
|
+
} else if (utils.isURLSearchParams(params)) {
|
622
|
+
serializedParams = params.toString();
|
623
|
+
} else {
|
624
|
+
var parts = [];
|
589
625
|
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
utils.isBuffer(data) ||
|
595
|
-
utils.isStream(data) ||
|
596
|
-
utils.isFile(data) ||
|
597
|
-
utils.isBlob(data)
|
598
|
-
) {
|
599
|
-
return data;
|
600
|
-
}
|
601
|
-
if (utils.isArrayBufferView(data)) {
|
602
|
-
return data.buffer;
|
603
|
-
}
|
604
|
-
if (utils.isURLSearchParams(data)) {
|
605
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
606
|
-
return data.toString();
|
607
|
-
}
|
608
|
-
if (utils.isObject(data)) {
|
609
|
-
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
610
|
-
return JSON.stringify(data);
|
611
|
-
}
|
612
|
-
return data;
|
613
|
-
}],
|
626
|
+
utils.forEach(params, function serialize(val, key) {
|
627
|
+
if (val === null || typeof val === 'undefined') {
|
628
|
+
return;
|
629
|
+
}
|
614
630
|
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
} catch (e) { /* Ignore */ }
|
621
|
-
}
|
622
|
-
return data;
|
623
|
-
}],
|
631
|
+
if (utils.isArray(val)) {
|
632
|
+
key = key + '[]';
|
633
|
+
} else {
|
634
|
+
val = [val];
|
635
|
+
}
|
624
636
|
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
637
|
+
utils.forEach(val, function parseValue(v) {
|
638
|
+
if (utils.isDate(v)) {
|
639
|
+
v = v.toISOString();
|
640
|
+
} else if (utils.isObject(v)) {
|
641
|
+
v = JSON.stringify(v);
|
642
|
+
}
|
643
|
+
parts.push(encode(key) + '=' + encode(v));
|
644
|
+
});
|
645
|
+
});
|
630
646
|
|
631
|
-
|
632
|
-
|
647
|
+
serializedParams = parts.join('&');
|
648
|
+
}
|
633
649
|
|
634
|
-
|
650
|
+
if (serializedParams) {
|
651
|
+
var hashmarkIndex = url.indexOf('#');
|
652
|
+
if (hashmarkIndex !== -1) {
|
653
|
+
url = url.slice(0, hashmarkIndex);
|
654
|
+
}
|
635
655
|
|
636
|
-
|
637
|
-
return status >= 200 && status < 300;
|
656
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
638
657
|
}
|
639
|
-
};
|
640
658
|
|
641
|
-
|
642
|
-
common: {
|
643
|
-
'Accept': 'application/json, text/plain, */*'
|
644
|
-
}
|
659
|
+
return url;
|
645
660
|
};
|
646
|
-
|
647
|
-
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
648
|
-
defaults.headers[method] = {};
|
649
|
-
});
|
650
|
-
|
651
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
652
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
653
|
-
});
|
654
|
-
|
655
|
-
module.exports = defaults;
|
656
661
|
|
657
662
|
|
658
663
|
/***/ }),
|
659
|
-
/*
|
664
|
+
/* 6 */
|
660
665
|
/***/ (function(module, exports, __webpack_require__) {
|
661
666
|
|
662
667
|
'use strict';
|
663
668
|
|
664
669
|
var utils = __webpack_require__(2);
|
665
670
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
+
function InterceptorManager() {
|
672
|
+
this.handlers = [];
|
673
|
+
}
|
674
|
+
|
675
|
+
/**
|
676
|
+
* Add a new interceptor to the stack
|
677
|
+
*
|
678
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
679
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
680
|
+
*
|
681
|
+
* @return {Number} An ID used to remove interceptor later
|
682
|
+
*/
|
683
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
684
|
+
this.handlers.push({
|
685
|
+
fulfilled: fulfilled,
|
686
|
+
rejected: rejected
|
687
|
+
});
|
688
|
+
return this.handlers.length - 1;
|
689
|
+
};
|
690
|
+
|
691
|
+
/**
|
692
|
+
* Remove an interceptor from the stack
|
693
|
+
*
|
694
|
+
* @param {Number} id The ID that was returned by `use`
|
695
|
+
*/
|
696
|
+
InterceptorManager.prototype.eject = function eject(id) {
|
697
|
+
if (this.handlers[id]) {
|
698
|
+
this.handlers[id] = null;
|
699
|
+
}
|
700
|
+
};
|
701
|
+
|
702
|
+
/**
|
703
|
+
* Iterate over all the registered interceptors
|
704
|
+
*
|
705
|
+
* This method is particularly useful for skipping over any
|
706
|
+
* interceptors that may have become `null` calling `eject`.
|
707
|
+
*
|
708
|
+
* @param {Function} fn The function to call for each interceptor
|
709
|
+
*/
|
710
|
+
InterceptorManager.prototype.forEach = function forEach(fn) {
|
711
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
712
|
+
if (h !== null) {
|
713
|
+
fn(h);
|
671
714
|
}
|
672
715
|
});
|
673
716
|
};
|
717
|
+
|
718
|
+
module.exports = InterceptorManager;
|
674
719
|
|
675
720
|
|
676
721
|
/***/ }),
|
677
|
-
/*
|
722
|
+
/* 7 */
|
678
723
|
/***/ (function(module, exports, __webpack_require__) {
|
679
724
|
|
680
725
|
'use strict';
|
681
726
|
|
682
727
|
var utils = __webpack_require__(2);
|
683
|
-
var
|
684
|
-
var
|
685
|
-
var
|
686
|
-
var isURLSameOrigin = __webpack_require__(14);
|
687
|
-
var createError = __webpack_require__(10);
|
688
|
-
var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(15);
|
689
|
-
|
690
|
-
module.exports = function xhrAdapter(config) {
|
691
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
692
|
-
var requestData = config.data;
|
693
|
-
var requestHeaders = config.headers;
|
694
|
-
|
695
|
-
if (utils.isFormData(requestData)) {
|
696
|
-
delete requestHeaders['Content-Type']; // Let the browser set it
|
697
|
-
}
|
728
|
+
var transformData = __webpack_require__(8);
|
729
|
+
var isCancel = __webpack_require__(9);
|
730
|
+
var defaults = __webpack_require__(10);
|
698
731
|
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
732
|
+
/**
|
733
|
+
* Throws a `Cancel` if cancellation has been requested.
|
734
|
+
*/
|
735
|
+
function throwIfCancellationRequested(config) {
|
736
|
+
if (config.cancelToken) {
|
737
|
+
config.cancelToken.throwIfRequested();
|
738
|
+
}
|
739
|
+
}
|
740
|
+
|
741
|
+
/**
|
742
|
+
* Dispatch a request to the server using the configured adapter.
|
743
|
+
*
|
744
|
+
* @param {object} config The config that is to be used for the request
|
745
|
+
* @returns {Promise} The Promise to be fulfilled
|
746
|
+
*/
|
747
|
+
module.exports = function dispatchRequest(config) {
|
748
|
+
throwIfCancellationRequested(config);
|
749
|
+
|
750
|
+
// Ensure headers exist
|
751
|
+
config.headers = config.headers || {};
|
752
|
+
|
753
|
+
// Transform request data
|
754
|
+
config.data = transformData(
|
755
|
+
config.data,
|
756
|
+
config.headers,
|
757
|
+
config.transformRequest
|
758
|
+
);
|
759
|
+
|
760
|
+
// Flatten headers
|
761
|
+
config.headers = utils.merge(
|
762
|
+
config.headers.common || {},
|
763
|
+
config.headers[config.method] || {},
|
764
|
+
config.headers
|
765
|
+
);
|
766
|
+
|
767
|
+
utils.forEach(
|
768
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
769
|
+
function cleanHeaderConfig(method) {
|
770
|
+
delete config.headers[method];
|
771
|
+
}
|
772
|
+
);
|
773
|
+
|
774
|
+
var adapter = config.adapter || defaults.adapter;
|
775
|
+
|
776
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
777
|
+
throwIfCancellationRequested(config);
|
778
|
+
|
779
|
+
// Transform response data
|
780
|
+
response.data = transformData(
|
781
|
+
response.data,
|
782
|
+
response.headers,
|
783
|
+
config.transformResponse
|
784
|
+
);
|
785
|
+
|
786
|
+
return response;
|
787
|
+
}, function onAdapterRejection(reason) {
|
788
|
+
if (!isCancel(reason)) {
|
789
|
+
throwIfCancellationRequested(config);
|
790
|
+
|
791
|
+
// Transform response data
|
792
|
+
if (reason && reason.response) {
|
793
|
+
reason.response.data = transformData(
|
794
|
+
reason.response.data,
|
795
|
+
reason.response.headers,
|
796
|
+
config.transformResponse
|
797
|
+
);
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
return Promise.reject(reason);
|
802
|
+
});
|
803
|
+
};
|
804
|
+
|
805
|
+
|
806
|
+
/***/ }),
|
807
|
+
/* 8 */
|
808
|
+
/***/ (function(module, exports, __webpack_require__) {
|
809
|
+
|
810
|
+
'use strict';
|
811
|
+
|
812
|
+
var utils = __webpack_require__(2);
|
813
|
+
|
814
|
+
/**
|
815
|
+
* Transform the data for a request or a response
|
816
|
+
*
|
817
|
+
* @param {Object|String} data The data to be transformed
|
818
|
+
* @param {Array} headers The headers for the request or response
|
819
|
+
* @param {Array|Function} fns A single function or Array of functions
|
820
|
+
* @returns {*} The resulting transformed data
|
821
|
+
*/
|
822
|
+
module.exports = function transformData(data, headers, fns) {
|
823
|
+
/*eslint no-param-reassign:0*/
|
824
|
+
utils.forEach(fns, function transform(fn) {
|
825
|
+
data = fn(data, headers);
|
826
|
+
});
|
827
|
+
|
828
|
+
return data;
|
829
|
+
};
|
830
|
+
|
831
|
+
|
832
|
+
/***/ }),
|
833
|
+
/* 9 */
|
834
|
+
/***/ (function(module, exports) {
|
835
|
+
|
836
|
+
'use strict';
|
837
|
+
|
838
|
+
module.exports = function isCancel(value) {
|
839
|
+
return !!(value && value.__CANCEL__);
|
840
|
+
};
|
841
|
+
|
842
|
+
|
843
|
+
/***/ }),
|
844
|
+
/* 10 */
|
845
|
+
/***/ (function(module, exports, __webpack_require__) {
|
846
|
+
|
847
|
+
'use strict';
|
848
|
+
|
849
|
+
var utils = __webpack_require__(2);
|
850
|
+
var normalizeHeaderName = __webpack_require__(11);
|
851
|
+
|
852
|
+
var DEFAULT_CONTENT_TYPE = {
|
853
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
854
|
+
};
|
855
|
+
|
856
|
+
function setContentTypeIfUnset(headers, value) {
|
857
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
858
|
+
headers['Content-Type'] = value;
|
859
|
+
}
|
860
|
+
}
|
861
|
+
|
862
|
+
function getDefaultAdapter() {
|
863
|
+
var adapter;
|
864
|
+
if (typeof XMLHttpRequest !== 'undefined') {
|
865
|
+
// For browsers use XHR adapter
|
866
|
+
adapter = __webpack_require__(12);
|
867
|
+
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
868
|
+
// For node use HTTP adapter
|
869
|
+
adapter = __webpack_require__(12);
|
870
|
+
}
|
871
|
+
return adapter;
|
872
|
+
}
|
873
|
+
|
874
|
+
var defaults = {
|
875
|
+
adapter: getDefaultAdapter(),
|
876
|
+
|
877
|
+
transformRequest: [function transformRequest(data, headers) {
|
878
|
+
normalizeHeaderName(headers, 'Accept');
|
879
|
+
normalizeHeaderName(headers, 'Content-Type');
|
880
|
+
if (utils.isFormData(data) ||
|
881
|
+
utils.isArrayBuffer(data) ||
|
882
|
+
utils.isBuffer(data) ||
|
883
|
+
utils.isStream(data) ||
|
884
|
+
utils.isFile(data) ||
|
885
|
+
utils.isBlob(data)
|
886
|
+
) {
|
887
|
+
return data;
|
888
|
+
}
|
889
|
+
if (utils.isArrayBufferView(data)) {
|
890
|
+
return data.buffer;
|
891
|
+
}
|
892
|
+
if (utils.isURLSearchParams(data)) {
|
893
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
894
|
+
return data.toString();
|
895
|
+
}
|
896
|
+
if (utils.isObject(data)) {
|
897
|
+
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
898
|
+
return JSON.stringify(data);
|
899
|
+
}
|
900
|
+
return data;
|
901
|
+
}],
|
902
|
+
|
903
|
+
transformResponse: [function transformResponse(data) {
|
904
|
+
/*eslint no-param-reassign:0*/
|
905
|
+
if (typeof data === 'string') {
|
906
|
+
try {
|
907
|
+
data = JSON.parse(data);
|
908
|
+
} catch (e) { /* Ignore */ }
|
909
|
+
}
|
910
|
+
return data;
|
911
|
+
}],
|
912
|
+
|
913
|
+
/**
|
914
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
915
|
+
* timeout is not created.
|
916
|
+
*/
|
917
|
+
timeout: 0,
|
918
|
+
|
919
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
920
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
921
|
+
|
922
|
+
maxContentLength: -1,
|
923
|
+
|
924
|
+
validateStatus: function validateStatus(status) {
|
925
|
+
return status >= 200 && status < 300;
|
926
|
+
}
|
927
|
+
};
|
928
|
+
|
929
|
+
defaults.headers = {
|
930
|
+
common: {
|
931
|
+
'Accept': 'application/json, text/plain, */*'
|
932
|
+
}
|
933
|
+
};
|
934
|
+
|
935
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
936
|
+
defaults.headers[method] = {};
|
937
|
+
});
|
938
|
+
|
939
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
940
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
941
|
+
});
|
942
|
+
|
943
|
+
module.exports = defaults;
|
944
|
+
|
945
|
+
|
946
|
+
/***/ }),
|
947
|
+
/* 11 */
|
948
|
+
/***/ (function(module, exports, __webpack_require__) {
|
949
|
+
|
950
|
+
'use strict';
|
951
|
+
|
952
|
+
var utils = __webpack_require__(2);
|
953
|
+
|
954
|
+
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
955
|
+
utils.forEach(headers, function processHeader(value, name) {
|
956
|
+
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
957
|
+
headers[normalizedName] = value;
|
958
|
+
delete headers[name];
|
959
|
+
}
|
960
|
+
});
|
961
|
+
};
|
962
|
+
|
963
|
+
|
964
|
+
/***/ }),
|
965
|
+
/* 12 */
|
966
|
+
/***/ (function(module, exports, __webpack_require__) {
|
967
|
+
|
968
|
+
'use strict';
|
969
|
+
|
970
|
+
var utils = __webpack_require__(2);
|
971
|
+
var settle = __webpack_require__(13);
|
972
|
+
var buildURL = __webpack_require__(5);
|
973
|
+
var buildFullPath = __webpack_require__(16);
|
974
|
+
var parseHeaders = __webpack_require__(19);
|
975
|
+
var isURLSameOrigin = __webpack_require__(20);
|
976
|
+
var createError = __webpack_require__(14);
|
977
|
+
|
978
|
+
module.exports = function xhrAdapter(config) {
|
979
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
980
|
+
var requestData = config.data;
|
981
|
+
var requestHeaders = config.headers;
|
982
|
+
|
983
|
+
if (utils.isFormData(requestData)) {
|
984
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
715
985
|
}
|
716
986
|
|
987
|
+
var request = new XMLHttpRequest();
|
988
|
+
|
717
989
|
// HTTP basic authentication
|
718
990
|
if (config.auth) {
|
719
991
|
var username = config.auth.username || '';
|
@@ -721,14 +993,15 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
721
993
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
722
994
|
}
|
723
995
|
|
724
|
-
|
996
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
997
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
725
998
|
|
726
999
|
// Set the request timeout in MS
|
727
1000
|
request.timeout = config.timeout;
|
728
1001
|
|
729
1002
|
// Listen for ready state
|
730
|
-
request
|
731
|
-
if (!request ||
|
1003
|
+
request.onreadystatechange = function handleLoad() {
|
1004
|
+
if (!request || request.readyState !== 4) {
|
732
1005
|
return;
|
733
1006
|
}
|
734
1007
|
|
@@ -745,9 +1018,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
745
1018
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
746
1019
|
var response = {
|
747
1020
|
data: responseData,
|
748
|
-
|
749
|
-
|
750
|
-
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
1021
|
+
status: request.status,
|
1022
|
+
statusText: request.statusText,
|
751
1023
|
headers: responseHeaders,
|
752
1024
|
config: config,
|
753
1025
|
request: request
|
@@ -759,6 +1031,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
759
1031
|
request = null;
|
760
1032
|
};
|
761
1033
|
|
1034
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
1035
|
+
request.onabort = function handleAbort() {
|
1036
|
+
if (!request) {
|
1037
|
+
return;
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
1041
|
+
|
1042
|
+
// Clean up request
|
1043
|
+
request = null;
|
1044
|
+
};
|
1045
|
+
|
762
1046
|
// Handle low level network errors
|
763
1047
|
request.onerror = function handleError() {
|
764
1048
|
// Real errors are hidden from us by the browser
|
@@ -771,7 +1055,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
771
1055
|
|
772
1056
|
// Handle timeout
|
773
1057
|
request.ontimeout = function handleTimeout() {
|
774
|
-
|
1058
|
+
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
1059
|
+
if (config.timeoutErrorMessage) {
|
1060
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
1061
|
+
}
|
1062
|
+
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
775
1063
|
request));
|
776
1064
|
|
777
1065
|
// Clean up request
|
@@ -782,12 +1070,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
782
1070
|
// This is only done if running in a standard browser environment.
|
783
1071
|
// Specifically not if we're in a web worker, or react-native.
|
784
1072
|
if (utils.isStandardBrowserEnv()) {
|
785
|
-
var cookies = __webpack_require__(
|
1073
|
+
var cookies = __webpack_require__(22);
|
786
1074
|
|
787
1075
|
// Add xsrf header
|
788
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(
|
789
|
-
|
790
|
-
|
1076
|
+
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
1077
|
+
cookies.read(config.xsrfCookieName) :
|
1078
|
+
undefined;
|
791
1079
|
|
792
1080
|
if (xsrfValue) {
|
793
1081
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
@@ -808,8 +1096,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
808
1096
|
}
|
809
1097
|
|
810
1098
|
// Add withCredentials to request if needed
|
811
|
-
if (config.withCredentials) {
|
812
|
-
request.withCredentials =
|
1099
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
1100
|
+
request.withCredentials = !!config.withCredentials;
|
813
1101
|
}
|
814
1102
|
|
815
1103
|
// Add responseType to request if needed
|
@@ -860,12 +1148,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
860
1148
|
|
861
1149
|
|
862
1150
|
/***/ }),
|
863
|
-
/*
|
1151
|
+
/* 13 */
|
864
1152
|
/***/ (function(module, exports, __webpack_require__) {
|
865
1153
|
|
866
1154
|
'use strict';
|
867
1155
|
|
868
|
-
var createError = __webpack_require__(
|
1156
|
+
var createError = __webpack_require__(14);
|
869
1157
|
|
870
1158
|
/**
|
871
1159
|
* Resolve or reject a Promise based on response status.
|
@@ -876,8 +1164,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
876
1164
|
*/
|
877
1165
|
module.exports = function settle(resolve, reject, response) {
|
878
1166
|
var validateStatus = response.config.validateStatus;
|
879
|
-
|
880
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1167
|
+
if (!validateStatus || validateStatus(response.status)) {
|
881
1168
|
resolve(response);
|
882
1169
|
} else {
|
883
1170
|
reject(createError(
|
@@ -892,12 +1179,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
892
1179
|
|
893
1180
|
|
894
1181
|
/***/ }),
|
895
|
-
/*
|
1182
|
+
/* 14 */
|
896
1183
|
/***/ (function(module, exports, __webpack_require__) {
|
897
1184
|
|
898
1185
|
'use strict';
|
899
1186
|
|
900
|
-
var enhanceError = __webpack_require__(
|
1187
|
+
var enhanceError = __webpack_require__(15);
|
901
1188
|
|
902
1189
|
/**
|
903
1190
|
* Create an Error with the specified message, config, error code, request and response.
|
@@ -916,7 +1203,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
916
1203
|
|
917
1204
|
|
918
1205
|
/***/ }),
|
919
|
-
/*
|
1206
|
+
/* 15 */
|
920
1207
|
/***/ (function(module, exports) {
|
921
1208
|
|
922
1209
|
'use strict';
|
@@ -936,86 +1223,101 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
936
1223
|
if (code) {
|
937
1224
|
error.code = code;
|
938
1225
|
}
|
1226
|
+
|
939
1227
|
error.request = request;
|
940
1228
|
error.response = response;
|
1229
|
+
error.isAxiosError = true;
|
1230
|
+
|
1231
|
+
error.toJSON = function() {
|
1232
|
+
return {
|
1233
|
+
// Standard
|
1234
|
+
message: this.message,
|
1235
|
+
name: this.name,
|
1236
|
+
// Microsoft
|
1237
|
+
description: this.description,
|
1238
|
+
number: this.number,
|
1239
|
+
// Mozilla
|
1240
|
+
fileName: this.fileName,
|
1241
|
+
lineNumber: this.lineNumber,
|
1242
|
+
columnNumber: this.columnNumber,
|
1243
|
+
stack: this.stack,
|
1244
|
+
// Axios
|
1245
|
+
config: this.config,
|
1246
|
+
code: this.code
|
1247
|
+
};
|
1248
|
+
};
|
941
1249
|
return error;
|
942
1250
|
};
|
943
1251
|
|
944
1252
|
|
945
1253
|
/***/ }),
|
946
|
-
/*
|
1254
|
+
/* 16 */
|
947
1255
|
/***/ (function(module, exports, __webpack_require__) {
|
948
1256
|
|
949
1257
|
'use strict';
|
950
1258
|
|
951
|
-
var
|
952
|
-
|
953
|
-
function encode(val) {
|
954
|
-
return encodeURIComponent(val).
|
955
|
-
replace(/%40/gi, '@').
|
956
|
-
replace(/%3A/gi, ':').
|
957
|
-
replace(/%24/g, '$').
|
958
|
-
replace(/%2C/gi, ',').
|
959
|
-
replace(/%20/g, '+').
|
960
|
-
replace(/%5B/gi, '[').
|
961
|
-
replace(/%5D/gi, ']');
|
962
|
-
}
|
1259
|
+
var isAbsoluteURL = __webpack_require__(17);
|
1260
|
+
var combineURLs = __webpack_require__(18);
|
963
1261
|
|
964
1262
|
/**
|
965
|
-
*
|
1263
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
1264
|
+
* only when the requestedURL is not already an absolute URL.
|
1265
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
966
1266
|
*
|
967
|
-
* @param {string}
|
968
|
-
* @param {
|
969
|
-
* @returns {string} The
|
1267
|
+
* @param {string} baseURL The base URL
|
1268
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
1269
|
+
* @returns {string} The combined full path
|
970
1270
|
*/
|
971
|
-
module.exports = function
|
972
|
-
|
973
|
-
|
974
|
-
return url;
|
975
|
-
}
|
976
|
-
|
977
|
-
var serializedParams;
|
978
|
-
if (paramsSerializer) {
|
979
|
-
serializedParams = paramsSerializer(params);
|
980
|
-
} else if (utils.isURLSearchParams(params)) {
|
981
|
-
serializedParams = params.toString();
|
982
|
-
} else {
|
983
|
-
var parts = [];
|
984
|
-
|
985
|
-
utils.forEach(params, function serialize(val, key) {
|
986
|
-
if (val === null || typeof val === 'undefined') {
|
987
|
-
return;
|
988
|
-
}
|
989
|
-
|
990
|
-
if (utils.isArray(val)) {
|
991
|
-
key = key + '[]';
|
992
|
-
} else {
|
993
|
-
val = [val];
|
994
|
-
}
|
995
|
-
|
996
|
-
utils.forEach(val, function parseValue(v) {
|
997
|
-
if (utils.isDate(v)) {
|
998
|
-
v = v.toISOString();
|
999
|
-
} else if (utils.isObject(v)) {
|
1000
|
-
v = JSON.stringify(v);
|
1001
|
-
}
|
1002
|
-
parts.push(encode(key) + '=' + encode(v));
|
1003
|
-
});
|
1004
|
-
});
|
1005
|
-
|
1006
|
-
serializedParams = parts.join('&');
|
1271
|
+
module.exports = function buildFullPath(baseURL, requestedURL) {
|
1272
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
1273
|
+
return combineURLs(baseURL, requestedURL);
|
1007
1274
|
}
|
1275
|
+
return requestedURL;
|
1276
|
+
};
|
1277
|
+
|
1278
|
+
|
1279
|
+
/***/ }),
|
1280
|
+
/* 17 */
|
1281
|
+
/***/ (function(module, exports) {
|
1282
|
+
|
1283
|
+
'use strict';
|
1008
1284
|
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1285
|
+
/**
|
1286
|
+
* Determines whether the specified URL is absolute
|
1287
|
+
*
|
1288
|
+
* @param {string} url The URL to test
|
1289
|
+
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1290
|
+
*/
|
1291
|
+
module.exports = function isAbsoluteURL(url) {
|
1292
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1293
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1294
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
1295
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1296
|
+
};
|
1297
|
+
|
1298
|
+
|
1299
|
+
/***/ }),
|
1300
|
+
/* 18 */
|
1301
|
+
/***/ (function(module, exports) {
|
1302
|
+
|
1303
|
+
'use strict';
|
1012
1304
|
|
1013
|
-
|
1305
|
+
/**
|
1306
|
+
* Creates a new URL by combining the specified URLs
|
1307
|
+
*
|
1308
|
+
* @param {string} baseURL The base URL
|
1309
|
+
* @param {string} relativeURL The relative URL
|
1310
|
+
* @returns {string} The combined URL
|
1311
|
+
*/
|
1312
|
+
module.exports = function combineURLs(baseURL, relativeURL) {
|
1313
|
+
return relativeURL
|
1314
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1315
|
+
: baseURL;
|
1014
1316
|
};
|
1015
1317
|
|
1016
1318
|
|
1017
1319
|
/***/ }),
|
1018
|
-
/*
|
1320
|
+
/* 19 */
|
1019
1321
|
/***/ (function(module, exports, __webpack_require__) {
|
1020
1322
|
|
1021
1323
|
'use strict';
|
@@ -1074,123 +1376,99 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1074
1376
|
|
1075
1377
|
|
1076
1378
|
/***/ }),
|
1077
|
-
/*
|
1379
|
+
/* 20 */
|
1078
1380
|
/***/ (function(module, exports, __webpack_require__) {
|
1079
1381
|
|
1080
1382
|
'use strict';
|
1081
1383
|
|
1082
1384
|
var utils = __webpack_require__(2);
|
1385
|
+
var isValidXss = __webpack_require__(21);
|
1083
1386
|
|
1084
1387
|
module.exports = (
|
1085
1388
|
utils.isStandardBrowserEnv() ?
|
1086
1389
|
|
1087
1390
|
// Standard browser envs have full support of the APIs needed to test
|
1088
1391
|
// whether the request URL is of the same origin as current location.
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1392
|
+
(function standardBrowserEnv() {
|
1393
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1394
|
+
var urlParsingNode = document.createElement('a');
|
1395
|
+
var originURL;
|
1093
1396
|
|
1094
|
-
|
1397
|
+
/**
|
1095
1398
|
* Parse a URL to discover it's components
|
1096
1399
|
*
|
1097
1400
|
* @param {String} url The URL to be parsed
|
1098
1401
|
* @returns {Object}
|
1099
1402
|
*/
|
1100
|
-
|
1101
|
-
|
1403
|
+
function resolveURL(url) {
|
1404
|
+
var href = url;
|
1405
|
+
|
1406
|
+
if (isValidXss(url)) {
|
1407
|
+
throw new Error('URL contains XSS injection attempt');
|
1408
|
+
}
|
1102
1409
|
|
1103
|
-
|
1410
|
+
if (msie) {
|
1104
1411
|
// IE needs attribute set twice to normalize properties
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1412
|
+
urlParsingNode.setAttribute('href', href);
|
1413
|
+
href = urlParsingNode.href;
|
1414
|
+
}
|
1108
1415
|
|
1109
|
-
|
1416
|
+
urlParsingNode.setAttribute('href', href);
|
1110
1417
|
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1418
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
1419
|
+
return {
|
1420
|
+
href: urlParsingNode.href,
|
1421
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
1422
|
+
host: urlParsingNode.host,
|
1423
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
1424
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
1425
|
+
hostname: urlParsingNode.hostname,
|
1426
|
+
port: urlParsingNode.port,
|
1427
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
1428
|
+
urlParsingNode.pathname :
|
1429
|
+
'/' + urlParsingNode.pathname
|
1430
|
+
};
|
1431
|
+
}
|
1125
1432
|
|
1126
|
-
|
1433
|
+
originURL = resolveURL(window.location.href);
|
1127
1434
|
|
1128
|
-
|
1435
|
+
/**
|
1129
1436
|
* Determine if a URL shares the same origin as the current location
|
1130
1437
|
*
|
1131
1438
|
* @param {String} requestURL The URL to test
|
1132
1439
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
1133
1440
|
*/
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1441
|
+
return function isURLSameOrigin(requestURL) {
|
1442
|
+
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
1443
|
+
return (parsed.protocol === originURL.protocol &&
|
1137
1444
|
parsed.host === originURL.host);
|
1138
|
-
|
1139
|
-
|
1445
|
+
};
|
1446
|
+
})() :
|
1140
1447
|
|
1141
1448
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1449
|
+
(function nonStandardBrowserEnv() {
|
1450
|
+
return function isURLSameOrigin() {
|
1451
|
+
return true;
|
1452
|
+
};
|
1453
|
+
})()
|
1147
1454
|
);
|
1148
1455
|
|
1149
1456
|
|
1150
1457
|
/***/ }),
|
1151
|
-
/*
|
1458
|
+
/* 21 */
|
1152
1459
|
/***/ (function(module, exports) {
|
1153
1460
|
|
1154
1461
|
'use strict';
|
1155
1462
|
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
function E() {
|
1161
|
-
this.message = 'String contains an invalid character';
|
1162
|
-
}
|
1163
|
-
E.prototype = new Error;
|
1164
|
-
E.prototype.code = 5;
|
1165
|
-
E.prototype.name = 'InvalidCharacterError';
|
1166
|
-
|
1167
|
-
function btoa(input) {
|
1168
|
-
var str = String(input);
|
1169
|
-
var output = '';
|
1170
|
-
for (
|
1171
|
-
// initialize result and counter
|
1172
|
-
var block, charCode, idx = 0, map = chars;
|
1173
|
-
// if the next str index does not exist:
|
1174
|
-
// change the mapping table to "="
|
1175
|
-
// check if d has no fractional digits
|
1176
|
-
str.charAt(idx | 0) || (map = '=', idx % 1);
|
1177
|
-
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
1178
|
-
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
1179
|
-
) {
|
1180
|
-
charCode = str.charCodeAt(idx += 3 / 4);
|
1181
|
-
if (charCode > 0xFF) {
|
1182
|
-
throw new E();
|
1183
|
-
}
|
1184
|
-
block = block << 8 | charCode;
|
1185
|
-
}
|
1186
|
-
return output;
|
1187
|
-
}
|
1463
|
+
module.exports = function isValidXss(requestURL) {
|
1464
|
+
var xssRegex = /(\b)(on\w+)=|javascript|(<\s*)(\/*)script/gi;
|
1465
|
+
return xssRegex.test(requestURL);
|
1466
|
+
};
|
1188
1467
|
|
1189
|
-
module.exports = btoa;
|
1190
1468
|
|
1191
1469
|
|
1192
1470
|
/***/ }),
|
1193
|
-
/*
|
1471
|
+
/* 22 */
|
1194
1472
|
/***/ (function(module, exports, __webpack_require__) {
|
1195
1473
|
|
1196
1474
|
'use strict';
|
@@ -1201,282 +1479,134 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1201
1479
|
utils.isStandardBrowserEnv() ?
|
1202
1480
|
|
1203
1481
|
// Standard browser envs support document.cookie
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1482
|
+
(function standardBrowserEnv() {
|
1483
|
+
return {
|
1484
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1485
|
+
var cookie = [];
|
1486
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
1209
1487
|
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1488
|
+
if (utils.isNumber(expires)) {
|
1489
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1490
|
+
}
|
1213
1491
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1492
|
+
if (utils.isString(path)) {
|
1493
|
+
cookie.push('path=' + path);
|
1494
|
+
}
|
1217
1495
|
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1496
|
+
if (utils.isString(domain)) {
|
1497
|
+
cookie.push('domain=' + domain);
|
1498
|
+
}
|
1221
1499
|
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1500
|
+
if (secure === true) {
|
1501
|
+
cookie.push('secure');
|
1502
|
+
}
|
1225
1503
|
|
1226
|
-
|
1227
|
-
|
1504
|
+
document.cookie = cookie.join('; ');
|
1505
|
+
},
|
1228
1506
|
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1507
|
+
read: function read(name) {
|
1508
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1509
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1510
|
+
},
|
1233
1511
|
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1512
|
+
remove: function remove(name) {
|
1513
|
+
this.write(name, '', Date.now() - 86400000);
|
1514
|
+
}
|
1515
|
+
};
|
1516
|
+
})() :
|
1239
1517
|
|
1240
1518
|
// Non standard browser env (web workers, react-native) lack needed support.
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1519
|
+
(function nonStandardBrowserEnv() {
|
1520
|
+
return {
|
1521
|
+
write: function write() {},
|
1522
|
+
read: function read() { return null; },
|
1523
|
+
remove: function remove() {}
|
1524
|
+
};
|
1525
|
+
})()
|
1248
1526
|
);
|
1249
1527
|
|
1250
1528
|
|
1251
1529
|
/***/ }),
|
1252
|
-
/*
|
1530
|
+
/* 23 */
|
1253
1531
|
/***/ (function(module, exports, __webpack_require__) {
|
1254
1532
|
|
1255
1533
|
'use strict';
|
1256
1534
|
|
1257
1535
|
var utils = __webpack_require__(2);
|
1258
1536
|
|
1259
|
-
function InterceptorManager() {
|
1260
|
-
this.handlers = [];
|
1261
|
-
}
|
1262
|
-
|
1263
1537
|
/**
|
1264
|
-
*
|
1265
|
-
*
|
1266
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
1267
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
1538
|
+
* Config-specific merge-function which creates a new config-object
|
1539
|
+
* by merging two configuration objects together.
|
1268
1540
|
*
|
1269
|
-
* @
|
1541
|
+
* @param {Object} config1
|
1542
|
+
* @param {Object} config2
|
1543
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
1270
1544
|
*/
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1545
|
+
module.exports = function mergeConfig(config1, config2) {
|
1546
|
+
// eslint-disable-next-line no-param-reassign
|
1547
|
+
config2 = config2 || {};
|
1548
|
+
var config = {};
|
1549
|
+
|
1550
|
+
var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
|
1551
|
+
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
|
1552
|
+
var defaultToConfig2Keys = [
|
1553
|
+
'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
1554
|
+
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
1555
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
|
1556
|
+
'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
|
1557
|
+
'httpsAgent', 'cancelToken', 'socketPath'
|
1558
|
+
];
|
1559
|
+
|
1560
|
+
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
1561
|
+
if (typeof config2[prop] !== 'undefined') {
|
1562
|
+
config[prop] = config2[prop];
|
1563
|
+
}
|
1275
1564
|
});
|
1276
|
-
return this.handlers.length - 1;
|
1277
|
-
};
|
1278
|
-
|
1279
|
-
/**
|
1280
|
-
* Remove an interceptor from the stack
|
1281
|
-
*
|
1282
|
-
* @param {Number} id The ID that was returned by `use`
|
1283
|
-
*/
|
1284
|
-
InterceptorManager.prototype.eject = function eject(id) {
|
1285
|
-
if (this.handlers[id]) {
|
1286
|
-
this.handlers[id] = null;
|
1287
|
-
}
|
1288
|
-
};
|
1289
1565
|
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
1300
|
-
if (h !== null) {
|
1301
|
-
fn(h);
|
1566
|
+
utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
|
1567
|
+
if (utils.isObject(config2[prop])) {
|
1568
|
+
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
|
1569
|
+
} else if (typeof config2[prop] !== 'undefined') {
|
1570
|
+
config[prop] = config2[prop];
|
1571
|
+
} else if (utils.isObject(config1[prop])) {
|
1572
|
+
config[prop] = utils.deepMerge(config1[prop]);
|
1573
|
+
} else if (typeof config1[prop] !== 'undefined') {
|
1574
|
+
config[prop] = config1[prop];
|
1302
1575
|
}
|
1303
1576
|
});
|
1304
|
-
};
|
1305
|
-
|
1306
|
-
module.exports = InterceptorManager;
|
1307
|
-
|
1308
|
-
|
1309
|
-
/***/ }),
|
1310
|
-
/* 18 */
|
1311
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1312
|
-
|
1313
|
-
'use strict';
|
1314
|
-
|
1315
|
-
var utils = __webpack_require__(2);
|
1316
|
-
var transformData = __webpack_require__(19);
|
1317
|
-
var isCancel = __webpack_require__(20);
|
1318
|
-
var defaults = __webpack_require__(6);
|
1319
|
-
var isAbsoluteURL = __webpack_require__(21);
|
1320
|
-
var combineURLs = __webpack_require__(22);
|
1321
|
-
|
1322
|
-
/**
|
1323
|
-
* Throws a `Cancel` if cancellation has been requested.
|
1324
|
-
*/
|
1325
|
-
function throwIfCancellationRequested(config) {
|
1326
|
-
if (config.cancelToken) {
|
1327
|
-
config.cancelToken.throwIfRequested();
|
1328
|
-
}
|
1329
|
-
}
|
1330
|
-
|
1331
|
-
/**
|
1332
|
-
* Dispatch a request to the server using the configured adapter.
|
1333
|
-
*
|
1334
|
-
* @param {object} config The config that is to be used for the request
|
1335
|
-
* @returns {Promise} The Promise to be fulfilled
|
1336
|
-
*/
|
1337
|
-
module.exports = function dispatchRequest(config) {
|
1338
|
-
throwIfCancellationRequested(config);
|
1339
|
-
|
1340
|
-
// Support baseURL config
|
1341
|
-
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
1342
|
-
config.url = combineURLs(config.baseURL, config.url);
|
1343
|
-
}
|
1344
|
-
|
1345
|
-
// Ensure headers exist
|
1346
|
-
config.headers = config.headers || {};
|
1347
|
-
|
1348
|
-
// Transform request data
|
1349
|
-
config.data = transformData(
|
1350
|
-
config.data,
|
1351
|
-
config.headers,
|
1352
|
-
config.transformRequest
|
1353
|
-
);
|
1354
|
-
|
1355
|
-
// Flatten headers
|
1356
|
-
config.headers = utils.merge(
|
1357
|
-
config.headers.common || {},
|
1358
|
-
config.headers[config.method] || {},
|
1359
|
-
config.headers || {}
|
1360
|
-
);
|
1361
1577
|
|
1362
|
-
utils.forEach(
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1578
|
+
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
1579
|
+
if (typeof config2[prop] !== 'undefined') {
|
1580
|
+
config[prop] = config2[prop];
|
1581
|
+
} else if (typeof config1[prop] !== 'undefined') {
|
1582
|
+
config[prop] = config1[prop];
|
1366
1583
|
}
|
1367
|
-
);
|
1368
|
-
|
1369
|
-
var adapter = config.adapter || defaults.adapter;
|
1370
|
-
|
1371
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
1372
|
-
throwIfCancellationRequested(config);
|
1584
|
+
});
|
1373
1585
|
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
response.headers,
|
1378
|
-
config.transformResponse
|
1379
|
-
);
|
1586
|
+
var axiosKeys = valueFromConfig2Keys
|
1587
|
+
.concat(mergeDeepPropertiesKeys)
|
1588
|
+
.concat(defaultToConfig2Keys);
|
1380
1589
|
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1590
|
+
var otherKeys = Object
|
1591
|
+
.keys(config2)
|
1592
|
+
.filter(function filterAxiosKeys(key) {
|
1593
|
+
return axiosKeys.indexOf(key) === -1;
|
1594
|
+
});
|
1385
1595
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
config.transformResponse
|
1392
|
-
);
|
1393
|
-
}
|
1596
|
+
utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
|
1597
|
+
if (typeof config2[prop] !== 'undefined') {
|
1598
|
+
config[prop] = config2[prop];
|
1599
|
+
} else if (typeof config1[prop] !== 'undefined') {
|
1600
|
+
config[prop] = config1[prop];
|
1394
1601
|
}
|
1395
|
-
|
1396
|
-
return Promise.reject(reason);
|
1397
|
-
});
|
1398
|
-
};
|
1399
|
-
|
1400
|
-
|
1401
|
-
/***/ }),
|
1402
|
-
/* 19 */
|
1403
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1404
|
-
|
1405
|
-
'use strict';
|
1406
|
-
|
1407
|
-
var utils = __webpack_require__(2);
|
1408
|
-
|
1409
|
-
/**
|
1410
|
-
* Transform the data for a request or a response
|
1411
|
-
*
|
1412
|
-
* @param {Object|String} data The data to be transformed
|
1413
|
-
* @param {Array} headers The headers for the request or response
|
1414
|
-
* @param {Array|Function} fns A single function or Array of functions
|
1415
|
-
* @returns {*} The resulting transformed data
|
1416
|
-
*/
|
1417
|
-
module.exports = function transformData(data, headers, fns) {
|
1418
|
-
/*eslint no-param-reassign:0*/
|
1419
|
-
utils.forEach(fns, function transform(fn) {
|
1420
|
-
data = fn(data, headers);
|
1421
1602
|
});
|
1422
1603
|
|
1423
|
-
return
|
1424
|
-
};
|
1425
|
-
|
1426
|
-
|
1427
|
-
/***/ }),
|
1428
|
-
/* 20 */
|
1429
|
-
/***/ (function(module, exports) {
|
1430
|
-
|
1431
|
-
'use strict';
|
1432
|
-
|
1433
|
-
module.exports = function isCancel(value) {
|
1434
|
-
return !!(value && value.__CANCEL__);
|
1435
|
-
};
|
1436
|
-
|
1437
|
-
|
1438
|
-
/***/ }),
|
1439
|
-
/* 21 */
|
1440
|
-
/***/ (function(module, exports) {
|
1441
|
-
|
1442
|
-
'use strict';
|
1443
|
-
|
1444
|
-
/**
|
1445
|
-
* Determines whether the specified URL is absolute
|
1446
|
-
*
|
1447
|
-
* @param {string} url The URL to test
|
1448
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
1449
|
-
*/
|
1450
|
-
module.exports = function isAbsoluteURL(url) {
|
1451
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
1452
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
1453
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
1454
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1455
|
-
};
|
1456
|
-
|
1457
|
-
|
1458
|
-
/***/ }),
|
1459
|
-
/* 22 */
|
1460
|
-
/***/ (function(module, exports) {
|
1461
|
-
|
1462
|
-
'use strict';
|
1463
|
-
|
1464
|
-
/**
|
1465
|
-
* Creates a new URL by combining the specified URLs
|
1466
|
-
*
|
1467
|
-
* @param {string} baseURL The base URL
|
1468
|
-
* @param {string} relativeURL The relative URL
|
1469
|
-
* @returns {string} The combined URL
|
1470
|
-
*/
|
1471
|
-
module.exports = function combineURLs(baseURL, relativeURL) {
|
1472
|
-
return relativeURL
|
1473
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
1474
|
-
: baseURL;
|
1604
|
+
return config;
|
1475
1605
|
};
|
1476
1606
|
|
1477
1607
|
|
1478
1608
|
/***/ }),
|
1479
|
-
/*
|
1609
|
+
/* 24 */
|
1480
1610
|
/***/ (function(module, exports) {
|
1481
1611
|
|
1482
1612
|
'use strict';
|
@@ -1501,12 +1631,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1501
1631
|
|
1502
1632
|
|
1503
1633
|
/***/ }),
|
1504
|
-
/*
|
1634
|
+
/* 25 */
|
1505
1635
|
/***/ (function(module, exports, __webpack_require__) {
|
1506
1636
|
|
1507
1637
|
'use strict';
|
1508
1638
|
|
1509
|
-
var Cancel = __webpack_require__(
|
1639
|
+
var Cancel = __webpack_require__(24);
|
1510
1640
|
|
1511
1641
|
/**
|
1512
1642
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
@@ -1564,7 +1694,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1564
1694
|
|
1565
1695
|
|
1566
1696
|
/***/ }),
|
1567
|
-
/*
|
1697
|
+
/* 26 */
|
1568
1698
|
/***/ (function(module, exports) {
|
1569
1699
|
|
1570
1700
|
'use strict';
|