@bigbinary/neeto-playwright-reporter 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +776 -390
- package/index.cjs.js.map +1 -1
- package/index.js +777 -390
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
import { camelToSnakeCase, keysToSnakeCase, keysToCamelCase } from '@bigbinary/neeto-cist';
|
|
3
|
-
import require$$1, { TextEncoder } from 'util';
|
|
3
|
+
import require$$1, { TextEncoder as TextEncoder$1 } from 'util';
|
|
4
4
|
import stream, { Readable } from 'stream';
|
|
5
5
|
import path$1 from 'path';
|
|
6
6
|
import require$$3 from 'http';
|
|
@@ -11,7 +11,7 @@ import require$$4$1 from 'assert';
|
|
|
11
11
|
import require$$1$1 from 'tty';
|
|
12
12
|
import require$$0$2 from 'os';
|
|
13
13
|
import zlib from 'zlib';
|
|
14
|
-
import EventEmitter from 'events';
|
|
14
|
+
import { EventEmitter } from 'events';
|
|
15
15
|
import { uniq, mergeDeepRight } from 'ramda';
|
|
16
16
|
import childProcess from 'child_process';
|
|
17
17
|
|
|
@@ -325,6 +325,8 @@ const isFormData = (thing) => {
|
|
|
325
325
|
*/
|
|
326
326
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
327
327
|
|
|
328
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
329
|
+
|
|
328
330
|
/**
|
|
329
331
|
* Trim excess whitespace off the beginning and end of a string
|
|
330
332
|
*
|
|
@@ -713,8 +715,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
713
715
|
const noop$1 = () => {};
|
|
714
716
|
|
|
715
717
|
const toFiniteNumber = (value, defaultValue) => {
|
|
716
|
-
value = +value;
|
|
717
|
-
return Number.isFinite(value) ? value : defaultValue;
|
|
718
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
718
719
|
};
|
|
719
720
|
|
|
720
721
|
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
@@ -784,6 +785,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
784
785
|
const isThenable = (thing) =>
|
|
785
786
|
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
786
787
|
|
|
788
|
+
// original code
|
|
789
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
790
|
+
|
|
791
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
792
|
+
if (setImmediateSupported) {
|
|
793
|
+
return setImmediate;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
797
|
+
_global.addEventListener("message", ({source, data}) => {
|
|
798
|
+
if (source === _global && data === token) {
|
|
799
|
+
callbacks.length && callbacks.shift()();
|
|
800
|
+
}
|
|
801
|
+
}, false);
|
|
802
|
+
|
|
803
|
+
return (cb) => {
|
|
804
|
+
callbacks.push(cb);
|
|
805
|
+
_global.postMessage(token, "*");
|
|
806
|
+
}
|
|
807
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
808
|
+
})(
|
|
809
|
+
typeof setImmediate === 'function',
|
|
810
|
+
isFunction$1(_global.postMessage)
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
814
|
+
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
815
|
+
|
|
816
|
+
// *********************
|
|
817
|
+
|
|
787
818
|
var utils$1 = {
|
|
788
819
|
isArray,
|
|
789
820
|
isArrayBuffer,
|
|
@@ -795,6 +826,10 @@ var utils$1 = {
|
|
|
795
826
|
isBoolean,
|
|
796
827
|
isObject,
|
|
797
828
|
isPlainObject,
|
|
829
|
+
isReadableStream,
|
|
830
|
+
isRequest,
|
|
831
|
+
isResponse,
|
|
832
|
+
isHeaders,
|
|
798
833
|
isUndefined,
|
|
799
834
|
isDate,
|
|
800
835
|
isFile,
|
|
@@ -835,7 +870,9 @@ var utils$1 = {
|
|
|
835
870
|
isSpecCompliantForm,
|
|
836
871
|
toJSONObject,
|
|
837
872
|
isAsyncFn,
|
|
838
|
-
isThenable
|
|
873
|
+
isThenable,
|
|
874
|
+
setImmediate: _setImmediate,
|
|
875
|
+
asap
|
|
839
876
|
};
|
|
840
877
|
|
|
841
878
|
/**
|
|
@@ -13507,11 +13544,14 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
13507
13544
|
);
|
|
13508
13545
|
})();
|
|
13509
13546
|
|
|
13547
|
+
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
13548
|
+
|
|
13510
13549
|
var utils = /*#__PURE__*/Object.freeze({
|
|
13511
13550
|
__proto__: null,
|
|
13512
13551
|
hasBrowserEnv: hasBrowserEnv,
|
|
13513
13552
|
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
13514
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
13553
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
13554
|
+
origin: origin
|
|
13515
13555
|
});
|
|
13516
13556
|
|
|
13517
13557
|
var platform = {
|
|
@@ -13651,7 +13691,7 @@ const defaults = {
|
|
|
13651
13691
|
|
|
13652
13692
|
transitional: transitionalDefaults,
|
|
13653
13693
|
|
|
13654
|
-
adapter: ['xhr', 'http'],
|
|
13694
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
13655
13695
|
|
|
13656
13696
|
transformRequest: [function transformRequest(data, headers) {
|
|
13657
13697
|
const contentType = headers.getContentType() || '';
|
|
@@ -13672,7 +13712,8 @@ const defaults = {
|
|
|
13672
13712
|
utils$1.isBuffer(data) ||
|
|
13673
13713
|
utils$1.isStream(data) ||
|
|
13674
13714
|
utils$1.isFile(data) ||
|
|
13675
|
-
utils$1.isBlob(data)
|
|
13715
|
+
utils$1.isBlob(data) ||
|
|
13716
|
+
utils$1.isReadableStream(data)
|
|
13676
13717
|
) {
|
|
13677
13718
|
return data;
|
|
13678
13719
|
}
|
|
@@ -13715,6 +13756,10 @@ const defaults = {
|
|
|
13715
13756
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
13716
13757
|
const JSONRequested = this.responseType === 'json';
|
|
13717
13758
|
|
|
13759
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
13760
|
+
return data;
|
|
13761
|
+
}
|
|
13762
|
+
|
|
13718
13763
|
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
13719
13764
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
13720
13765
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
@@ -13916,6 +13961,10 @@ class AxiosHeaders {
|
|
|
13916
13961
|
setHeaders(header, valueOrRewrite);
|
|
13917
13962
|
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
13918
13963
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
13964
|
+
} else if (utils$1.isHeaders(header)) {
|
|
13965
|
+
for (const [key, value] of header.entries()) {
|
|
13966
|
+
setHeader(value, key, rewrite);
|
|
13967
|
+
}
|
|
13919
13968
|
} else {
|
|
13920
13969
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
13921
13970
|
}
|
|
@@ -16214,7 +16263,7 @@ function isURL(value) {
|
|
|
16214
16263
|
followRedirects.exports = wrap({ http: http, https: https });
|
|
16215
16264
|
followRedirects.exports.wrap = wrap;
|
|
16216
16265
|
|
|
16217
|
-
const VERSION = "1.
|
|
16266
|
+
const VERSION = "1.7.4";
|
|
16218
16267
|
|
|
16219
16268
|
function parseProtocol(url) {
|
|
16220
16269
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -16269,88 +16318,6 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
16269
16318
|
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
16270
16319
|
}
|
|
16271
16320
|
|
|
16272
|
-
/**
|
|
16273
|
-
* Throttle decorator
|
|
16274
|
-
* @param {Function} fn
|
|
16275
|
-
* @param {Number} freq
|
|
16276
|
-
* @return {Function}
|
|
16277
|
-
*/
|
|
16278
|
-
function throttle(fn, freq) {
|
|
16279
|
-
let timestamp = 0;
|
|
16280
|
-
const threshold = 1000 / freq;
|
|
16281
|
-
let timer = null;
|
|
16282
|
-
return function throttled(force, args) {
|
|
16283
|
-
const now = Date.now();
|
|
16284
|
-
if (force || now - timestamp > threshold) {
|
|
16285
|
-
if (timer) {
|
|
16286
|
-
clearTimeout(timer);
|
|
16287
|
-
timer = null;
|
|
16288
|
-
}
|
|
16289
|
-
timestamp = now;
|
|
16290
|
-
return fn.apply(null, args);
|
|
16291
|
-
}
|
|
16292
|
-
if (!timer) {
|
|
16293
|
-
timer = setTimeout(() => {
|
|
16294
|
-
timer = null;
|
|
16295
|
-
timestamp = Date.now();
|
|
16296
|
-
return fn.apply(null, args);
|
|
16297
|
-
}, threshold - (now - timestamp));
|
|
16298
|
-
}
|
|
16299
|
-
};
|
|
16300
|
-
}
|
|
16301
|
-
|
|
16302
|
-
/**
|
|
16303
|
-
* Calculate data maxRate
|
|
16304
|
-
* @param {Number} [samplesCount= 10]
|
|
16305
|
-
* @param {Number} [min= 1000]
|
|
16306
|
-
* @returns {Function}
|
|
16307
|
-
*/
|
|
16308
|
-
function speedometer(samplesCount, min) {
|
|
16309
|
-
samplesCount = samplesCount || 10;
|
|
16310
|
-
const bytes = new Array(samplesCount);
|
|
16311
|
-
const timestamps = new Array(samplesCount);
|
|
16312
|
-
let head = 0;
|
|
16313
|
-
let tail = 0;
|
|
16314
|
-
let firstSampleTS;
|
|
16315
|
-
|
|
16316
|
-
min = min !== undefined ? min : 1000;
|
|
16317
|
-
|
|
16318
|
-
return function push(chunkLength) {
|
|
16319
|
-
const now = Date.now();
|
|
16320
|
-
|
|
16321
|
-
const startedAt = timestamps[tail];
|
|
16322
|
-
|
|
16323
|
-
if (!firstSampleTS) {
|
|
16324
|
-
firstSampleTS = now;
|
|
16325
|
-
}
|
|
16326
|
-
|
|
16327
|
-
bytes[head] = chunkLength;
|
|
16328
|
-
timestamps[head] = now;
|
|
16329
|
-
|
|
16330
|
-
let i = tail;
|
|
16331
|
-
let bytesCount = 0;
|
|
16332
|
-
|
|
16333
|
-
while (i !== head) {
|
|
16334
|
-
bytesCount += bytes[i++];
|
|
16335
|
-
i = i % samplesCount;
|
|
16336
|
-
}
|
|
16337
|
-
|
|
16338
|
-
head = (head + 1) % samplesCount;
|
|
16339
|
-
|
|
16340
|
-
if (head === tail) {
|
|
16341
|
-
tail = (tail + 1) % samplesCount;
|
|
16342
|
-
}
|
|
16343
|
-
|
|
16344
|
-
if (now - firstSampleTS < min) {
|
|
16345
|
-
return;
|
|
16346
|
-
}
|
|
16347
|
-
|
|
16348
|
-
const passed = startedAt && now - startedAt;
|
|
16349
|
-
|
|
16350
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
16351
|
-
};
|
|
16352
|
-
}
|
|
16353
|
-
|
|
16354
16321
|
const kInternals = Symbol('internals');
|
|
16355
16322
|
|
|
16356
16323
|
class AxiosTransformStream extends stream.Transform{
|
|
@@ -16370,12 +16337,8 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16370
16337
|
readableHighWaterMark: options.chunkSize
|
|
16371
16338
|
});
|
|
16372
16339
|
|
|
16373
|
-
const self = this;
|
|
16374
|
-
|
|
16375
16340
|
const internals = this[kInternals] = {
|
|
16376
|
-
length: options.length,
|
|
16377
16341
|
timeWindow: options.timeWindow,
|
|
16378
|
-
ticksRate: options.ticksRate,
|
|
16379
16342
|
chunkSize: options.chunkSize,
|
|
16380
16343
|
maxRate: options.maxRate,
|
|
16381
16344
|
minChunkSize: options.minChunkSize,
|
|
@@ -16387,8 +16350,6 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16387
16350
|
onReadCallback: null
|
|
16388
16351
|
};
|
|
16389
16352
|
|
|
16390
|
-
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
|
16391
|
-
|
|
16392
16353
|
this.on('newListener', event => {
|
|
16393
16354
|
if (event === 'progress') {
|
|
16394
16355
|
if (!internals.isCaptured) {
|
|
@@ -16396,38 +16357,6 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16396
16357
|
}
|
|
16397
16358
|
}
|
|
16398
16359
|
});
|
|
16399
|
-
|
|
16400
|
-
let bytesNotified = 0;
|
|
16401
|
-
|
|
16402
|
-
internals.updateProgress = throttle(function throttledHandler() {
|
|
16403
|
-
const totalBytes = internals.length;
|
|
16404
|
-
const bytesTransferred = internals.bytesSeen;
|
|
16405
|
-
const progressBytes = bytesTransferred - bytesNotified;
|
|
16406
|
-
if (!progressBytes || self.destroyed) return;
|
|
16407
|
-
|
|
16408
|
-
const rate = _speedometer(progressBytes);
|
|
16409
|
-
|
|
16410
|
-
bytesNotified = bytesTransferred;
|
|
16411
|
-
|
|
16412
|
-
process.nextTick(() => {
|
|
16413
|
-
self.emit('progress', {
|
|
16414
|
-
'loaded': bytesTransferred,
|
|
16415
|
-
'total': totalBytes,
|
|
16416
|
-
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
|
16417
|
-
'bytes': progressBytes,
|
|
16418
|
-
'rate': rate ? rate : undefined,
|
|
16419
|
-
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
|
16420
|
-
(totalBytes - bytesTransferred) / rate : undefined
|
|
16421
|
-
});
|
|
16422
|
-
});
|
|
16423
|
-
}, internals.ticksRate);
|
|
16424
|
-
|
|
16425
|
-
const onFinish = () => {
|
|
16426
|
-
internals.updateProgress(true);
|
|
16427
|
-
};
|
|
16428
|
-
|
|
16429
|
-
this.once('end', onFinish);
|
|
16430
|
-
this.once('error', onFinish);
|
|
16431
16360
|
}
|
|
16432
16361
|
|
|
16433
16362
|
_read(size) {
|
|
@@ -16441,7 +16370,6 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16441
16370
|
}
|
|
16442
16371
|
|
|
16443
16372
|
_transform(chunk, encoding, callback) {
|
|
16444
|
-
const self = this;
|
|
16445
16373
|
const internals = this[kInternals];
|
|
16446
16374
|
const maxRate = internals.maxRate;
|
|
16447
16375
|
|
|
@@ -16453,16 +16381,14 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16453
16381
|
const bytesThreshold = (maxRate / divider);
|
|
16454
16382
|
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
16455
16383
|
|
|
16456
|
-
|
|
16384
|
+
const pushChunk = (_chunk, _callback) => {
|
|
16457
16385
|
const bytes = Buffer.byteLength(_chunk);
|
|
16458
16386
|
internals.bytesSeen += bytes;
|
|
16459
16387
|
internals.bytes += bytes;
|
|
16460
16388
|
|
|
16461
|
-
|
|
16462
|
-
internals.updateProgress();
|
|
16463
|
-
}
|
|
16389
|
+
internals.isCaptured && this.emit('progress', internals.bytesSeen);
|
|
16464
16390
|
|
|
16465
|
-
if (
|
|
16391
|
+
if (this.push(_chunk)) {
|
|
16466
16392
|
process.nextTick(_callback);
|
|
16467
16393
|
} else {
|
|
16468
16394
|
internals.onReadCallback = () => {
|
|
@@ -16470,7 +16396,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16470
16396
|
process.nextTick(_callback);
|
|
16471
16397
|
};
|
|
16472
16398
|
}
|
|
16473
|
-
}
|
|
16399
|
+
};
|
|
16474
16400
|
|
|
16475
16401
|
const transformChunk = (_chunk, _callback) => {
|
|
16476
16402
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
@@ -16527,11 +16453,6 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
16527
16453
|
}
|
|
16528
16454
|
});
|
|
16529
16455
|
}
|
|
16530
|
-
|
|
16531
|
-
setLength(length) {
|
|
16532
|
-
this[kInternals].length = +length;
|
|
16533
|
-
return this;
|
|
16534
|
-
}
|
|
16535
16456
|
}
|
|
16536
16457
|
|
|
16537
16458
|
const {asyncIterator} = Symbol;
|
|
@@ -16550,7 +16471,7 @@ const readBlob = async function* (blob) {
|
|
|
16550
16471
|
|
|
16551
16472
|
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
|
|
16552
16473
|
|
|
16553
|
-
const textEncoder = new TextEncoder();
|
|
16474
|
+
const textEncoder = new TextEncoder$1();
|
|
16554
16475
|
|
|
16555
16476
|
const CRLF = '\r\n';
|
|
16556
16477
|
const CRLF_BYTES = textEncoder.encode(CRLF);
|
|
@@ -16689,6 +16610,142 @@ const callbackify = (fn, reducer) => {
|
|
|
16689
16610
|
} : fn;
|
|
16690
16611
|
};
|
|
16691
16612
|
|
|
16613
|
+
/**
|
|
16614
|
+
* Calculate data maxRate
|
|
16615
|
+
* @param {Number} [samplesCount= 10]
|
|
16616
|
+
* @param {Number} [min= 1000]
|
|
16617
|
+
* @returns {Function}
|
|
16618
|
+
*/
|
|
16619
|
+
function speedometer(samplesCount, min) {
|
|
16620
|
+
samplesCount = samplesCount || 10;
|
|
16621
|
+
const bytes = new Array(samplesCount);
|
|
16622
|
+
const timestamps = new Array(samplesCount);
|
|
16623
|
+
let head = 0;
|
|
16624
|
+
let tail = 0;
|
|
16625
|
+
let firstSampleTS;
|
|
16626
|
+
|
|
16627
|
+
min = min !== undefined ? min : 1000;
|
|
16628
|
+
|
|
16629
|
+
return function push(chunkLength) {
|
|
16630
|
+
const now = Date.now();
|
|
16631
|
+
|
|
16632
|
+
const startedAt = timestamps[tail];
|
|
16633
|
+
|
|
16634
|
+
if (!firstSampleTS) {
|
|
16635
|
+
firstSampleTS = now;
|
|
16636
|
+
}
|
|
16637
|
+
|
|
16638
|
+
bytes[head] = chunkLength;
|
|
16639
|
+
timestamps[head] = now;
|
|
16640
|
+
|
|
16641
|
+
let i = tail;
|
|
16642
|
+
let bytesCount = 0;
|
|
16643
|
+
|
|
16644
|
+
while (i !== head) {
|
|
16645
|
+
bytesCount += bytes[i++];
|
|
16646
|
+
i = i % samplesCount;
|
|
16647
|
+
}
|
|
16648
|
+
|
|
16649
|
+
head = (head + 1) % samplesCount;
|
|
16650
|
+
|
|
16651
|
+
if (head === tail) {
|
|
16652
|
+
tail = (tail + 1) % samplesCount;
|
|
16653
|
+
}
|
|
16654
|
+
|
|
16655
|
+
if (now - firstSampleTS < min) {
|
|
16656
|
+
return;
|
|
16657
|
+
}
|
|
16658
|
+
|
|
16659
|
+
const passed = startedAt && now - startedAt;
|
|
16660
|
+
|
|
16661
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
16662
|
+
};
|
|
16663
|
+
}
|
|
16664
|
+
|
|
16665
|
+
/**
|
|
16666
|
+
* Throttle decorator
|
|
16667
|
+
* @param {Function} fn
|
|
16668
|
+
* @param {Number} freq
|
|
16669
|
+
* @return {Function}
|
|
16670
|
+
*/
|
|
16671
|
+
function throttle(fn, freq) {
|
|
16672
|
+
let timestamp = 0;
|
|
16673
|
+
let threshold = 1000 / freq;
|
|
16674
|
+
let lastArgs;
|
|
16675
|
+
let timer;
|
|
16676
|
+
|
|
16677
|
+
const invoke = (args, now = Date.now()) => {
|
|
16678
|
+
timestamp = now;
|
|
16679
|
+
lastArgs = null;
|
|
16680
|
+
if (timer) {
|
|
16681
|
+
clearTimeout(timer);
|
|
16682
|
+
timer = null;
|
|
16683
|
+
}
|
|
16684
|
+
fn.apply(null, args);
|
|
16685
|
+
};
|
|
16686
|
+
|
|
16687
|
+
const throttled = (...args) => {
|
|
16688
|
+
const now = Date.now();
|
|
16689
|
+
const passed = now - timestamp;
|
|
16690
|
+
if ( passed >= threshold) {
|
|
16691
|
+
invoke(args, now);
|
|
16692
|
+
} else {
|
|
16693
|
+
lastArgs = args;
|
|
16694
|
+
if (!timer) {
|
|
16695
|
+
timer = setTimeout(() => {
|
|
16696
|
+
timer = null;
|
|
16697
|
+
invoke(lastArgs);
|
|
16698
|
+
}, threshold - passed);
|
|
16699
|
+
}
|
|
16700
|
+
}
|
|
16701
|
+
};
|
|
16702
|
+
|
|
16703
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
16704
|
+
|
|
16705
|
+
return [throttled, flush];
|
|
16706
|
+
}
|
|
16707
|
+
|
|
16708
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
16709
|
+
let bytesNotified = 0;
|
|
16710
|
+
const _speedometer = speedometer(50, 250);
|
|
16711
|
+
|
|
16712
|
+
return throttle(e => {
|
|
16713
|
+
const loaded = e.loaded;
|
|
16714
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
16715
|
+
const progressBytes = loaded - bytesNotified;
|
|
16716
|
+
const rate = _speedometer(progressBytes);
|
|
16717
|
+
const inRange = loaded <= total;
|
|
16718
|
+
|
|
16719
|
+
bytesNotified = loaded;
|
|
16720
|
+
|
|
16721
|
+
const data = {
|
|
16722
|
+
loaded,
|
|
16723
|
+
total,
|
|
16724
|
+
progress: total ? (loaded / total) : undefined,
|
|
16725
|
+
bytes: progressBytes,
|
|
16726
|
+
rate: rate ? rate : undefined,
|
|
16727
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
16728
|
+
event: e,
|
|
16729
|
+
lengthComputable: total != null,
|
|
16730
|
+
[isDownloadStream ? 'download' : 'upload']: true
|
|
16731
|
+
};
|
|
16732
|
+
|
|
16733
|
+
listener(data);
|
|
16734
|
+
}, freq);
|
|
16735
|
+
};
|
|
16736
|
+
|
|
16737
|
+
const progressEventDecorator = (total, throttled) => {
|
|
16738
|
+
const lengthComputable = total != null;
|
|
16739
|
+
|
|
16740
|
+
return [(loaded) => throttled[0]({
|
|
16741
|
+
lengthComputable,
|
|
16742
|
+
total,
|
|
16743
|
+
loaded
|
|
16744
|
+
}), throttled[1]];
|
|
16745
|
+
};
|
|
16746
|
+
|
|
16747
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
16748
|
+
|
|
16692
16749
|
const zlibOptions = {
|
|
16693
16750
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
16694
16751
|
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
@@ -16709,6 +16766,14 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
16709
16766
|
return protocol + ':';
|
|
16710
16767
|
});
|
|
16711
16768
|
|
|
16769
|
+
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
16770
|
+
stream
|
|
16771
|
+
.on('end', flush)
|
|
16772
|
+
.on('error', flush);
|
|
16773
|
+
|
|
16774
|
+
return throttled;
|
|
16775
|
+
};
|
|
16776
|
+
|
|
16712
16777
|
/**
|
|
16713
16778
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
16714
16779
|
* object.
|
|
@@ -16884,7 +16949,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
16884
16949
|
|
|
16885
16950
|
// Parse url
|
|
16886
16951
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
16887
|
-
const parsed = new URL(fullPath,
|
|
16952
|
+
const parsed = new URL(fullPath, utils$1.hasBrowserEnv ? platform.origin : undefined);
|
|
16888
16953
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
16889
16954
|
|
|
16890
16955
|
if (protocol === 'data:') {
|
|
@@ -16942,8 +17007,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
16942
17007
|
// Only set header if it hasn't been set in config
|
|
16943
17008
|
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
16944
17009
|
|
|
16945
|
-
const onDownloadProgress = config
|
|
16946
|
-
const onUploadProgress = config.onUploadProgress;
|
|
17010
|
+
const {onUploadProgress, onDownloadProgress} = config;
|
|
16947
17011
|
const maxRate = config.maxRate;
|
|
16948
17012
|
let maxUploadRate = undefined;
|
|
16949
17013
|
let maxDownloadRate = undefined;
|
|
@@ -17014,15 +17078,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
17014
17078
|
}
|
|
17015
17079
|
|
|
17016
17080
|
data = stream.pipeline([data, new AxiosTransformStream({
|
|
17017
|
-
length: contentLength,
|
|
17018
17081
|
maxRate: utils$1.toFiniteNumber(maxUploadRate)
|
|
17019
17082
|
})], utils$1.noop);
|
|
17020
17083
|
|
|
17021
|
-
onUploadProgress && data.on('progress',
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17084
|
+
onUploadProgress && data.on('progress', flushOnFinish(
|
|
17085
|
+
data,
|
|
17086
|
+
progressEventDecorator(
|
|
17087
|
+
contentLength,
|
|
17088
|
+
progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
|
|
17089
|
+
)
|
|
17090
|
+
));
|
|
17026
17091
|
}
|
|
17027
17092
|
|
|
17028
17093
|
// HTTP basic authentication
|
|
@@ -17121,17 +17186,18 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
17121
17186
|
|
|
17122
17187
|
const responseLength = +res.headers['content-length'];
|
|
17123
17188
|
|
|
17124
|
-
if (onDownloadProgress) {
|
|
17189
|
+
if (onDownloadProgress || maxDownloadRate) {
|
|
17125
17190
|
const transformStream = new AxiosTransformStream({
|
|
17126
|
-
length: utils$1.toFiniteNumber(responseLength),
|
|
17127
17191
|
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
|
|
17128
17192
|
});
|
|
17129
17193
|
|
|
17130
|
-
onDownloadProgress && transformStream.on('progress',
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17194
|
+
onDownloadProgress && transformStream.on('progress', flushOnFinish(
|
|
17195
|
+
transformStream,
|
|
17196
|
+
progressEventDecorator(
|
|
17197
|
+
responseLength,
|
|
17198
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
|
|
17199
|
+
)
|
|
17200
|
+
));
|
|
17135
17201
|
|
|
17136
17202
|
streams.push(transformStream);
|
|
17137
17203
|
}
|
|
@@ -17344,45 +17410,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
17344
17410
|
});
|
|
17345
17411
|
};
|
|
17346
17412
|
|
|
17347
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
17348
|
-
|
|
17349
|
-
// Standard browser envs support document.cookie
|
|
17350
|
-
{
|
|
17351
|
-
write(name, value, expires, path, domain, secure) {
|
|
17352
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
17353
|
-
|
|
17354
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
17355
|
-
|
|
17356
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
17357
|
-
|
|
17358
|
-
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
17359
|
-
|
|
17360
|
-
secure === true && cookie.push('secure');
|
|
17361
|
-
|
|
17362
|
-
document.cookie = cookie.join('; ');
|
|
17363
|
-
},
|
|
17364
|
-
|
|
17365
|
-
read(name) {
|
|
17366
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
17367
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
17368
|
-
},
|
|
17369
|
-
|
|
17370
|
-
remove(name) {
|
|
17371
|
-
this.write(name, '', Date.now() - 86400000);
|
|
17372
|
-
}
|
|
17373
|
-
}
|
|
17374
|
-
|
|
17375
|
-
:
|
|
17376
|
-
|
|
17377
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
17378
|
-
{
|
|
17379
|
-
write() {},
|
|
17380
|
-
read() {
|
|
17381
|
-
return null;
|
|
17382
|
-
},
|
|
17383
|
-
remove() {}
|
|
17384
|
-
};
|
|
17385
|
-
|
|
17386
17413
|
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
17387
17414
|
|
|
17388
17415
|
// Standard browser envs have full support of the APIs needed to test
|
|
@@ -17446,80 +17473,222 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
|
17446
17473
|
};
|
|
17447
17474
|
})();
|
|
17448
17475
|
|
|
17449
|
-
|
|
17450
|
-
let bytesNotified = 0;
|
|
17451
|
-
const _speedometer = speedometer(50, 250);
|
|
17476
|
+
var cookies = platform.hasStandardBrowserEnv ?
|
|
17452
17477
|
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
const rate = _speedometer(progressBytes);
|
|
17458
|
-
const inRange = loaded <= total;
|
|
17478
|
+
// Standard browser envs support document.cookie
|
|
17479
|
+
{
|
|
17480
|
+
write(name, value, expires, path, domain, secure) {
|
|
17481
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
17459
17482
|
|
|
17460
|
-
|
|
17483
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
17461
17484
|
|
|
17462
|
-
|
|
17463
|
-
loaded,
|
|
17464
|
-
total,
|
|
17465
|
-
progress: total ? (loaded / total) : undefined,
|
|
17466
|
-
bytes: progressBytes,
|
|
17467
|
-
rate: rate ? rate : undefined,
|
|
17468
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
17469
|
-
event: e
|
|
17470
|
-
};
|
|
17485
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
17471
17486
|
|
|
17472
|
-
|
|
17487
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
17473
17488
|
|
|
17474
|
-
|
|
17489
|
+
secure === true && cookie.push('secure');
|
|
17490
|
+
|
|
17491
|
+
document.cookie = cookie.join('; ');
|
|
17492
|
+
},
|
|
17493
|
+
|
|
17494
|
+
read(name) {
|
|
17495
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
17496
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
17497
|
+
},
|
|
17498
|
+
|
|
17499
|
+
remove(name) {
|
|
17500
|
+
this.write(name, '', Date.now() - 86400000);
|
|
17501
|
+
}
|
|
17502
|
+
}
|
|
17503
|
+
|
|
17504
|
+
:
|
|
17505
|
+
|
|
17506
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
17507
|
+
{
|
|
17508
|
+
write() {},
|
|
17509
|
+
read() {
|
|
17510
|
+
return null;
|
|
17511
|
+
},
|
|
17512
|
+
remove() {}
|
|
17475
17513
|
};
|
|
17514
|
+
|
|
17515
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
17516
|
+
|
|
17517
|
+
/**
|
|
17518
|
+
* Config-specific merge-function which creates a new config-object
|
|
17519
|
+
* by merging two configuration objects together.
|
|
17520
|
+
*
|
|
17521
|
+
* @param {Object} config1
|
|
17522
|
+
* @param {Object} config2
|
|
17523
|
+
*
|
|
17524
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
17525
|
+
*/
|
|
17526
|
+
function mergeConfig(config1, config2) {
|
|
17527
|
+
// eslint-disable-next-line no-param-reassign
|
|
17528
|
+
config2 = config2 || {};
|
|
17529
|
+
const config = {};
|
|
17530
|
+
|
|
17531
|
+
function getMergedValue(target, source, caseless) {
|
|
17532
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
17533
|
+
return utils$1.merge.call({caseless}, target, source);
|
|
17534
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
17535
|
+
return utils$1.merge({}, source);
|
|
17536
|
+
} else if (utils$1.isArray(source)) {
|
|
17537
|
+
return source.slice();
|
|
17538
|
+
}
|
|
17539
|
+
return source;
|
|
17540
|
+
}
|
|
17541
|
+
|
|
17542
|
+
// eslint-disable-next-line consistent-return
|
|
17543
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
17544
|
+
if (!utils$1.isUndefined(b)) {
|
|
17545
|
+
return getMergedValue(a, b, caseless);
|
|
17546
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
17547
|
+
return getMergedValue(undefined, a, caseless);
|
|
17548
|
+
}
|
|
17549
|
+
}
|
|
17550
|
+
|
|
17551
|
+
// eslint-disable-next-line consistent-return
|
|
17552
|
+
function valueFromConfig2(a, b) {
|
|
17553
|
+
if (!utils$1.isUndefined(b)) {
|
|
17554
|
+
return getMergedValue(undefined, b);
|
|
17555
|
+
}
|
|
17556
|
+
}
|
|
17557
|
+
|
|
17558
|
+
// eslint-disable-next-line consistent-return
|
|
17559
|
+
function defaultToConfig2(a, b) {
|
|
17560
|
+
if (!utils$1.isUndefined(b)) {
|
|
17561
|
+
return getMergedValue(undefined, b);
|
|
17562
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
17563
|
+
return getMergedValue(undefined, a);
|
|
17564
|
+
}
|
|
17565
|
+
}
|
|
17566
|
+
|
|
17567
|
+
// eslint-disable-next-line consistent-return
|
|
17568
|
+
function mergeDirectKeys(a, b, prop) {
|
|
17569
|
+
if (prop in config2) {
|
|
17570
|
+
return getMergedValue(a, b);
|
|
17571
|
+
} else if (prop in config1) {
|
|
17572
|
+
return getMergedValue(undefined, a);
|
|
17573
|
+
}
|
|
17574
|
+
}
|
|
17575
|
+
|
|
17576
|
+
const mergeMap = {
|
|
17577
|
+
url: valueFromConfig2,
|
|
17578
|
+
method: valueFromConfig2,
|
|
17579
|
+
data: valueFromConfig2,
|
|
17580
|
+
baseURL: defaultToConfig2,
|
|
17581
|
+
transformRequest: defaultToConfig2,
|
|
17582
|
+
transformResponse: defaultToConfig2,
|
|
17583
|
+
paramsSerializer: defaultToConfig2,
|
|
17584
|
+
timeout: defaultToConfig2,
|
|
17585
|
+
timeoutMessage: defaultToConfig2,
|
|
17586
|
+
withCredentials: defaultToConfig2,
|
|
17587
|
+
withXSRFToken: defaultToConfig2,
|
|
17588
|
+
adapter: defaultToConfig2,
|
|
17589
|
+
responseType: defaultToConfig2,
|
|
17590
|
+
xsrfCookieName: defaultToConfig2,
|
|
17591
|
+
xsrfHeaderName: defaultToConfig2,
|
|
17592
|
+
onUploadProgress: defaultToConfig2,
|
|
17593
|
+
onDownloadProgress: defaultToConfig2,
|
|
17594
|
+
decompress: defaultToConfig2,
|
|
17595
|
+
maxContentLength: defaultToConfig2,
|
|
17596
|
+
maxBodyLength: defaultToConfig2,
|
|
17597
|
+
beforeRedirect: defaultToConfig2,
|
|
17598
|
+
transport: defaultToConfig2,
|
|
17599
|
+
httpAgent: defaultToConfig2,
|
|
17600
|
+
httpsAgent: defaultToConfig2,
|
|
17601
|
+
cancelToken: defaultToConfig2,
|
|
17602
|
+
socketPath: defaultToConfig2,
|
|
17603
|
+
responseEncoding: defaultToConfig2,
|
|
17604
|
+
validateStatus: mergeDirectKeys,
|
|
17605
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
17606
|
+
};
|
|
17607
|
+
|
|
17608
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
17609
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
17610
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
17611
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
17612
|
+
});
|
|
17613
|
+
|
|
17614
|
+
return config;
|
|
17476
17615
|
}
|
|
17477
17616
|
|
|
17478
|
-
|
|
17617
|
+
var resolveConfig = (config) => {
|
|
17618
|
+
const newConfig = mergeConfig({}, config);
|
|
17479
17619
|
|
|
17480
|
-
|
|
17481
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
17482
|
-
let requestData = config.data;
|
|
17483
|
-
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
17484
|
-
let {responseType, withXSRFToken} = config;
|
|
17485
|
-
let onCanceled;
|
|
17486
|
-
function done() {
|
|
17487
|
-
if (config.cancelToken) {
|
|
17488
|
-
config.cancelToken.unsubscribe(onCanceled);
|
|
17489
|
-
}
|
|
17620
|
+
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
17490
17621
|
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17622
|
+
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
17623
|
+
|
|
17624
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
17625
|
+
|
|
17626
|
+
// HTTP basic authentication
|
|
17627
|
+
if (auth) {
|
|
17628
|
+
headers.set('Authorization', 'Basic ' +
|
|
17629
|
+
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
17630
|
+
);
|
|
17631
|
+
}
|
|
17632
|
+
|
|
17633
|
+
let contentType;
|
|
17634
|
+
|
|
17635
|
+
if (utils$1.isFormData(data)) {
|
|
17636
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
17637
|
+
headers.setContentType(undefined); // Let the browser set it
|
|
17638
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
17639
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
17640
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
17641
|
+
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
17494
17642
|
}
|
|
17643
|
+
}
|
|
17644
|
+
|
|
17645
|
+
// Add xsrf header
|
|
17646
|
+
// This is only done if running in a standard browser environment.
|
|
17647
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
17648
|
+
|
|
17649
|
+
if (platform.hasStandardBrowserEnv) {
|
|
17650
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
17495
17651
|
|
|
17496
|
-
|
|
17652
|
+
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
17653
|
+
// Add xsrf header
|
|
17654
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
17497
17655
|
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
requestHeaders.setContentType(false); // Let the browser set it
|
|
17501
|
-
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
17502
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
17503
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
17504
|
-
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
17656
|
+
if (xsrfValue) {
|
|
17657
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
17505
17658
|
}
|
|
17506
17659
|
}
|
|
17660
|
+
}
|
|
17507
17661
|
|
|
17508
|
-
|
|
17662
|
+
return newConfig;
|
|
17663
|
+
};
|
|
17509
17664
|
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17665
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
17666
|
+
|
|
17667
|
+
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
17668
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
17669
|
+
const _config = resolveConfig(config);
|
|
17670
|
+
let requestData = _config.data;
|
|
17671
|
+
const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
|
|
17672
|
+
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
17673
|
+
let onCanceled;
|
|
17674
|
+
let uploadThrottled, downloadThrottled;
|
|
17675
|
+
let flushUpload, flushDownload;
|
|
17676
|
+
|
|
17677
|
+
function done() {
|
|
17678
|
+
flushUpload && flushUpload(); // flush events
|
|
17679
|
+
flushDownload && flushDownload(); // flush events
|
|
17680
|
+
|
|
17681
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
17682
|
+
|
|
17683
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
17515
17684
|
}
|
|
17516
17685
|
|
|
17517
|
-
|
|
17686
|
+
let request = new XMLHttpRequest();
|
|
17518
17687
|
|
|
17519
|
-
request.open(
|
|
17688
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
17520
17689
|
|
|
17521
17690
|
// Set the request timeout in MS
|
|
17522
|
-
request.timeout =
|
|
17691
|
+
request.timeout = _config.timeout;
|
|
17523
17692
|
|
|
17524
17693
|
function onloadend() {
|
|
17525
17694
|
if (!request) {
|
|
@@ -17599,10 +17768,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
17599
17768
|
|
|
17600
17769
|
// Handle timeout
|
|
17601
17770
|
request.ontimeout = function handleTimeout() {
|
|
17602
|
-
let timeoutErrorMessage =
|
|
17603
|
-
const transitional =
|
|
17604
|
-
if (
|
|
17605
|
-
timeoutErrorMessage =
|
|
17771
|
+
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
17772
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
17773
|
+
if (_config.timeoutErrorMessage) {
|
|
17774
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
17606
17775
|
}
|
|
17607
17776
|
reject(new AxiosError(
|
|
17608
17777
|
timeoutErrorMessage,
|
|
@@ -17614,22 +17783,6 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
17614
17783
|
request = null;
|
|
17615
17784
|
};
|
|
17616
17785
|
|
|
17617
|
-
// Add xsrf header
|
|
17618
|
-
// This is only done if running in a standard browser environment.
|
|
17619
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
17620
|
-
if(platform.hasStandardBrowserEnv) {
|
|
17621
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
17622
|
-
|
|
17623
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
|
|
17624
|
-
// Add xsrf header
|
|
17625
|
-
const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
17626
|
-
|
|
17627
|
-
if (xsrfValue) {
|
|
17628
|
-
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
17629
|
-
}
|
|
17630
|
-
}
|
|
17631
|
-
}
|
|
17632
|
-
|
|
17633
17786
|
// Remove Content-Type if data is undefined
|
|
17634
17787
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
17635
17788
|
|
|
@@ -17641,26 +17794,31 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
17641
17794
|
}
|
|
17642
17795
|
|
|
17643
17796
|
// Add withCredentials to request if needed
|
|
17644
|
-
if (!utils$1.isUndefined(
|
|
17645
|
-
request.withCredentials = !!
|
|
17797
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
17798
|
+
request.withCredentials = !!_config.withCredentials;
|
|
17646
17799
|
}
|
|
17647
17800
|
|
|
17648
17801
|
// Add responseType to request if needed
|
|
17649
17802
|
if (responseType && responseType !== 'json') {
|
|
17650
|
-
request.responseType =
|
|
17803
|
+
request.responseType = _config.responseType;
|
|
17651
17804
|
}
|
|
17652
17805
|
|
|
17653
17806
|
// Handle progress if needed
|
|
17654
|
-
if (
|
|
17655
|
-
|
|
17807
|
+
if (onDownloadProgress) {
|
|
17808
|
+
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
|
17809
|
+
request.addEventListener('progress', downloadThrottled);
|
|
17656
17810
|
}
|
|
17657
17811
|
|
|
17658
17812
|
// Not all browsers support upload events
|
|
17659
|
-
if (
|
|
17660
|
-
|
|
17813
|
+
if (onUploadProgress && request.upload) {
|
|
17814
|
+
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
17815
|
+
|
|
17816
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
17817
|
+
|
|
17818
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
17661
17819
|
}
|
|
17662
17820
|
|
|
17663
|
-
if (
|
|
17821
|
+
if (_config.cancelToken || _config.signal) {
|
|
17664
17822
|
// Handle cancellation
|
|
17665
17823
|
// eslint-disable-next-line func-names
|
|
17666
17824
|
onCanceled = cancel => {
|
|
@@ -17672,13 +17830,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
17672
17830
|
request = null;
|
|
17673
17831
|
};
|
|
17674
17832
|
|
|
17675
|
-
|
|
17676
|
-
if (
|
|
17677
|
-
|
|
17833
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
17834
|
+
if (_config.signal) {
|
|
17835
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
17678
17836
|
}
|
|
17679
17837
|
}
|
|
17680
17838
|
|
|
17681
|
-
const protocol = parseProtocol(
|
|
17839
|
+
const protocol = parseProtocol(_config.url);
|
|
17682
17840
|
|
|
17683
17841
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
17684
17842
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -17691,9 +17849,337 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
17691
17849
|
});
|
|
17692
17850
|
};
|
|
17693
17851
|
|
|
17852
|
+
const composeSignals = (signals, timeout) => {
|
|
17853
|
+
let controller = new AbortController();
|
|
17854
|
+
|
|
17855
|
+
let aborted;
|
|
17856
|
+
|
|
17857
|
+
const onabort = function (cancel) {
|
|
17858
|
+
if (!aborted) {
|
|
17859
|
+
aborted = true;
|
|
17860
|
+
unsubscribe();
|
|
17861
|
+
const err = cancel instanceof Error ? cancel : this.reason;
|
|
17862
|
+
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
17863
|
+
}
|
|
17864
|
+
};
|
|
17865
|
+
|
|
17866
|
+
let timer = timeout && setTimeout(() => {
|
|
17867
|
+
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
17868
|
+
}, timeout);
|
|
17869
|
+
|
|
17870
|
+
const unsubscribe = () => {
|
|
17871
|
+
if (signals) {
|
|
17872
|
+
timer && clearTimeout(timer);
|
|
17873
|
+
timer = null;
|
|
17874
|
+
signals.forEach(signal => {
|
|
17875
|
+
signal &&
|
|
17876
|
+
(signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
|
|
17877
|
+
});
|
|
17878
|
+
signals = null;
|
|
17879
|
+
}
|
|
17880
|
+
};
|
|
17881
|
+
|
|
17882
|
+
signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
|
|
17883
|
+
|
|
17884
|
+
const {signal} = controller;
|
|
17885
|
+
|
|
17886
|
+
signal.unsubscribe = unsubscribe;
|
|
17887
|
+
|
|
17888
|
+
return [signal, () => {
|
|
17889
|
+
timer && clearTimeout(timer);
|
|
17890
|
+
timer = null;
|
|
17891
|
+
}];
|
|
17892
|
+
};
|
|
17893
|
+
|
|
17894
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
17895
|
+
let len = chunk.byteLength;
|
|
17896
|
+
|
|
17897
|
+
if (!chunkSize || len < chunkSize) {
|
|
17898
|
+
yield chunk;
|
|
17899
|
+
return;
|
|
17900
|
+
}
|
|
17901
|
+
|
|
17902
|
+
let pos = 0;
|
|
17903
|
+
let end;
|
|
17904
|
+
|
|
17905
|
+
while (pos < len) {
|
|
17906
|
+
end = pos + chunkSize;
|
|
17907
|
+
yield chunk.slice(pos, end);
|
|
17908
|
+
pos = end;
|
|
17909
|
+
}
|
|
17910
|
+
};
|
|
17911
|
+
|
|
17912
|
+
const readBytes = async function* (iterable, chunkSize, encode) {
|
|
17913
|
+
for await (const chunk of iterable) {
|
|
17914
|
+
yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
|
|
17915
|
+
}
|
|
17916
|
+
};
|
|
17917
|
+
|
|
17918
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
17919
|
+
const iterator = readBytes(stream, chunkSize, encode);
|
|
17920
|
+
|
|
17921
|
+
let bytes = 0;
|
|
17922
|
+
let done;
|
|
17923
|
+
let _onFinish = (e) => {
|
|
17924
|
+
if (!done) {
|
|
17925
|
+
done = true;
|
|
17926
|
+
onFinish && onFinish(e);
|
|
17927
|
+
}
|
|
17928
|
+
};
|
|
17929
|
+
|
|
17930
|
+
return new ReadableStream({
|
|
17931
|
+
async pull(controller) {
|
|
17932
|
+
try {
|
|
17933
|
+
const {done, value} = await iterator.next();
|
|
17934
|
+
|
|
17935
|
+
if (done) {
|
|
17936
|
+
_onFinish();
|
|
17937
|
+
controller.close();
|
|
17938
|
+
return;
|
|
17939
|
+
}
|
|
17940
|
+
|
|
17941
|
+
let len = value.byteLength;
|
|
17942
|
+
if (onProgress) {
|
|
17943
|
+
let loadedBytes = bytes += len;
|
|
17944
|
+
onProgress(loadedBytes);
|
|
17945
|
+
}
|
|
17946
|
+
controller.enqueue(new Uint8Array(value));
|
|
17947
|
+
} catch (err) {
|
|
17948
|
+
_onFinish(err);
|
|
17949
|
+
throw err;
|
|
17950
|
+
}
|
|
17951
|
+
},
|
|
17952
|
+
cancel(reason) {
|
|
17953
|
+
_onFinish(reason);
|
|
17954
|
+
return iterator.return();
|
|
17955
|
+
}
|
|
17956
|
+
}, {
|
|
17957
|
+
highWaterMark: 2
|
|
17958
|
+
})
|
|
17959
|
+
};
|
|
17960
|
+
|
|
17961
|
+
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
17962
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
17963
|
+
|
|
17964
|
+
// used only inside the fetch adapter
|
|
17965
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
17966
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
17967
|
+
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
17968
|
+
);
|
|
17969
|
+
|
|
17970
|
+
const test = (fn, ...args) => {
|
|
17971
|
+
try {
|
|
17972
|
+
return !!fn(...args);
|
|
17973
|
+
} catch (e) {
|
|
17974
|
+
return false
|
|
17975
|
+
}
|
|
17976
|
+
};
|
|
17977
|
+
|
|
17978
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
17979
|
+
let duplexAccessed = false;
|
|
17980
|
+
|
|
17981
|
+
const hasContentType = new Request(platform.origin, {
|
|
17982
|
+
body: new ReadableStream(),
|
|
17983
|
+
method: 'POST',
|
|
17984
|
+
get duplex() {
|
|
17985
|
+
duplexAccessed = true;
|
|
17986
|
+
return 'half';
|
|
17987
|
+
},
|
|
17988
|
+
}).headers.has('Content-Type');
|
|
17989
|
+
|
|
17990
|
+
return duplexAccessed && !hasContentType;
|
|
17991
|
+
});
|
|
17992
|
+
|
|
17993
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
17994
|
+
|
|
17995
|
+
const supportsResponseStream = isReadableStreamSupported &&
|
|
17996
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
17997
|
+
|
|
17998
|
+
|
|
17999
|
+
const resolvers = {
|
|
18000
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
18001
|
+
};
|
|
18002
|
+
|
|
18003
|
+
isFetchSupported && (((res) => {
|
|
18004
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
18005
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
18006
|
+
(_, config) => {
|
|
18007
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
18008
|
+
});
|
|
18009
|
+
});
|
|
18010
|
+
})(new Response));
|
|
18011
|
+
|
|
18012
|
+
const getBodyLength = async (body) => {
|
|
18013
|
+
if (body == null) {
|
|
18014
|
+
return 0;
|
|
18015
|
+
}
|
|
18016
|
+
|
|
18017
|
+
if(utils$1.isBlob(body)) {
|
|
18018
|
+
return body.size;
|
|
18019
|
+
}
|
|
18020
|
+
|
|
18021
|
+
if(utils$1.isSpecCompliantForm(body)) {
|
|
18022
|
+
return (await new Request(body).arrayBuffer()).byteLength;
|
|
18023
|
+
}
|
|
18024
|
+
|
|
18025
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
18026
|
+
return body.byteLength;
|
|
18027
|
+
}
|
|
18028
|
+
|
|
18029
|
+
if(utils$1.isURLSearchParams(body)) {
|
|
18030
|
+
body = body + '';
|
|
18031
|
+
}
|
|
18032
|
+
|
|
18033
|
+
if(utils$1.isString(body)) {
|
|
18034
|
+
return (await encodeText(body)).byteLength;
|
|
18035
|
+
}
|
|
18036
|
+
};
|
|
18037
|
+
|
|
18038
|
+
const resolveBodyLength = async (headers, body) => {
|
|
18039
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
18040
|
+
|
|
18041
|
+
return length == null ? getBodyLength(body) : length;
|
|
18042
|
+
};
|
|
18043
|
+
|
|
18044
|
+
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
18045
|
+
let {
|
|
18046
|
+
url,
|
|
18047
|
+
method,
|
|
18048
|
+
data,
|
|
18049
|
+
signal,
|
|
18050
|
+
cancelToken,
|
|
18051
|
+
timeout,
|
|
18052
|
+
onDownloadProgress,
|
|
18053
|
+
onUploadProgress,
|
|
18054
|
+
responseType,
|
|
18055
|
+
headers,
|
|
18056
|
+
withCredentials = 'same-origin',
|
|
18057
|
+
fetchOptions
|
|
18058
|
+
} = resolveConfig(config);
|
|
18059
|
+
|
|
18060
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
18061
|
+
|
|
18062
|
+
let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
|
|
18063
|
+
composeSignals([signal, cancelToken], timeout) : [];
|
|
18064
|
+
|
|
18065
|
+
let finished, request;
|
|
18066
|
+
|
|
18067
|
+
const onFinish = () => {
|
|
18068
|
+
!finished && setTimeout(() => {
|
|
18069
|
+
composedSignal && composedSignal.unsubscribe();
|
|
18070
|
+
});
|
|
18071
|
+
|
|
18072
|
+
finished = true;
|
|
18073
|
+
};
|
|
18074
|
+
|
|
18075
|
+
let requestContentLength;
|
|
18076
|
+
|
|
18077
|
+
try {
|
|
18078
|
+
if (
|
|
18079
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
18080
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
18081
|
+
) {
|
|
18082
|
+
let _request = new Request(url, {
|
|
18083
|
+
method: 'POST',
|
|
18084
|
+
body: data,
|
|
18085
|
+
duplex: "half"
|
|
18086
|
+
});
|
|
18087
|
+
|
|
18088
|
+
let contentTypeHeader;
|
|
18089
|
+
|
|
18090
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
18091
|
+
headers.setContentType(contentTypeHeader);
|
|
18092
|
+
}
|
|
18093
|
+
|
|
18094
|
+
if (_request.body) {
|
|
18095
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
18096
|
+
requestContentLength,
|
|
18097
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
18098
|
+
);
|
|
18099
|
+
|
|
18100
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
|
|
18101
|
+
}
|
|
18102
|
+
}
|
|
18103
|
+
|
|
18104
|
+
if (!utils$1.isString(withCredentials)) {
|
|
18105
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
18106
|
+
}
|
|
18107
|
+
|
|
18108
|
+
request = new Request(url, {
|
|
18109
|
+
...fetchOptions,
|
|
18110
|
+
signal: composedSignal,
|
|
18111
|
+
method: method.toUpperCase(),
|
|
18112
|
+
headers: headers.normalize().toJSON(),
|
|
18113
|
+
body: data,
|
|
18114
|
+
duplex: "half",
|
|
18115
|
+
credentials: withCredentials
|
|
18116
|
+
});
|
|
18117
|
+
|
|
18118
|
+
let response = await fetch(request);
|
|
18119
|
+
|
|
18120
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
18121
|
+
|
|
18122
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
|
18123
|
+
const options = {};
|
|
18124
|
+
|
|
18125
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
18126
|
+
options[prop] = response[prop];
|
|
18127
|
+
});
|
|
18128
|
+
|
|
18129
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
18130
|
+
|
|
18131
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
18132
|
+
responseContentLength,
|
|
18133
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
18134
|
+
) || [];
|
|
18135
|
+
|
|
18136
|
+
response = new Response(
|
|
18137
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
18138
|
+
flush && flush();
|
|
18139
|
+
isStreamResponse && onFinish();
|
|
18140
|
+
}, encodeText),
|
|
18141
|
+
options
|
|
18142
|
+
);
|
|
18143
|
+
}
|
|
18144
|
+
|
|
18145
|
+
responseType = responseType || 'text';
|
|
18146
|
+
|
|
18147
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
18148
|
+
|
|
18149
|
+
!isStreamResponse && onFinish();
|
|
18150
|
+
|
|
18151
|
+
stopTimeout && stopTimeout();
|
|
18152
|
+
|
|
18153
|
+
return await new Promise((resolve, reject) => {
|
|
18154
|
+
settle(resolve, reject, {
|
|
18155
|
+
data: responseData,
|
|
18156
|
+
headers: AxiosHeaders.from(response.headers),
|
|
18157
|
+
status: response.status,
|
|
18158
|
+
statusText: response.statusText,
|
|
18159
|
+
config,
|
|
18160
|
+
request
|
|
18161
|
+
});
|
|
18162
|
+
})
|
|
18163
|
+
} catch (err) {
|
|
18164
|
+
onFinish();
|
|
18165
|
+
|
|
18166
|
+
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
18167
|
+
throw Object.assign(
|
|
18168
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
18169
|
+
{
|
|
18170
|
+
cause: err.cause || err
|
|
18171
|
+
}
|
|
18172
|
+
)
|
|
18173
|
+
}
|
|
18174
|
+
|
|
18175
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
18176
|
+
}
|
|
18177
|
+
});
|
|
18178
|
+
|
|
17694
18179
|
const knownAdapters = {
|
|
17695
18180
|
http: httpAdapter,
|
|
17696
|
-
xhr: xhrAdapter
|
|
18181
|
+
xhr: xhrAdapter,
|
|
18182
|
+
fetch: fetchAdapter
|
|
17697
18183
|
};
|
|
17698
18184
|
|
|
17699
18185
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
@@ -17837,108 +18323,6 @@ function dispatchRequest(config) {
|
|
|
17837
18323
|
});
|
|
17838
18324
|
}
|
|
17839
18325
|
|
|
17840
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
17841
|
-
|
|
17842
|
-
/**
|
|
17843
|
-
* Config-specific merge-function which creates a new config-object
|
|
17844
|
-
* by merging two configuration objects together.
|
|
17845
|
-
*
|
|
17846
|
-
* @param {Object} config1
|
|
17847
|
-
* @param {Object} config2
|
|
17848
|
-
*
|
|
17849
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
17850
|
-
*/
|
|
17851
|
-
function mergeConfig(config1, config2) {
|
|
17852
|
-
// eslint-disable-next-line no-param-reassign
|
|
17853
|
-
config2 = config2 || {};
|
|
17854
|
-
const config = {};
|
|
17855
|
-
|
|
17856
|
-
function getMergedValue(target, source, caseless) {
|
|
17857
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
17858
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
17859
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
17860
|
-
return utils$1.merge({}, source);
|
|
17861
|
-
} else if (utils$1.isArray(source)) {
|
|
17862
|
-
return source.slice();
|
|
17863
|
-
}
|
|
17864
|
-
return source;
|
|
17865
|
-
}
|
|
17866
|
-
|
|
17867
|
-
// eslint-disable-next-line consistent-return
|
|
17868
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
17869
|
-
if (!utils$1.isUndefined(b)) {
|
|
17870
|
-
return getMergedValue(a, b, caseless);
|
|
17871
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
17872
|
-
return getMergedValue(undefined, a, caseless);
|
|
17873
|
-
}
|
|
17874
|
-
}
|
|
17875
|
-
|
|
17876
|
-
// eslint-disable-next-line consistent-return
|
|
17877
|
-
function valueFromConfig2(a, b) {
|
|
17878
|
-
if (!utils$1.isUndefined(b)) {
|
|
17879
|
-
return getMergedValue(undefined, b);
|
|
17880
|
-
}
|
|
17881
|
-
}
|
|
17882
|
-
|
|
17883
|
-
// eslint-disable-next-line consistent-return
|
|
17884
|
-
function defaultToConfig2(a, b) {
|
|
17885
|
-
if (!utils$1.isUndefined(b)) {
|
|
17886
|
-
return getMergedValue(undefined, b);
|
|
17887
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
17888
|
-
return getMergedValue(undefined, a);
|
|
17889
|
-
}
|
|
17890
|
-
}
|
|
17891
|
-
|
|
17892
|
-
// eslint-disable-next-line consistent-return
|
|
17893
|
-
function mergeDirectKeys(a, b, prop) {
|
|
17894
|
-
if (prop in config2) {
|
|
17895
|
-
return getMergedValue(a, b);
|
|
17896
|
-
} else if (prop in config1) {
|
|
17897
|
-
return getMergedValue(undefined, a);
|
|
17898
|
-
}
|
|
17899
|
-
}
|
|
17900
|
-
|
|
17901
|
-
const mergeMap = {
|
|
17902
|
-
url: valueFromConfig2,
|
|
17903
|
-
method: valueFromConfig2,
|
|
17904
|
-
data: valueFromConfig2,
|
|
17905
|
-
baseURL: defaultToConfig2,
|
|
17906
|
-
transformRequest: defaultToConfig2,
|
|
17907
|
-
transformResponse: defaultToConfig2,
|
|
17908
|
-
paramsSerializer: defaultToConfig2,
|
|
17909
|
-
timeout: defaultToConfig2,
|
|
17910
|
-
timeoutMessage: defaultToConfig2,
|
|
17911
|
-
withCredentials: defaultToConfig2,
|
|
17912
|
-
withXSRFToken: defaultToConfig2,
|
|
17913
|
-
adapter: defaultToConfig2,
|
|
17914
|
-
responseType: defaultToConfig2,
|
|
17915
|
-
xsrfCookieName: defaultToConfig2,
|
|
17916
|
-
xsrfHeaderName: defaultToConfig2,
|
|
17917
|
-
onUploadProgress: defaultToConfig2,
|
|
17918
|
-
onDownloadProgress: defaultToConfig2,
|
|
17919
|
-
decompress: defaultToConfig2,
|
|
17920
|
-
maxContentLength: defaultToConfig2,
|
|
17921
|
-
maxBodyLength: defaultToConfig2,
|
|
17922
|
-
beforeRedirect: defaultToConfig2,
|
|
17923
|
-
transport: defaultToConfig2,
|
|
17924
|
-
httpAgent: defaultToConfig2,
|
|
17925
|
-
httpsAgent: defaultToConfig2,
|
|
17926
|
-
cancelToken: defaultToConfig2,
|
|
17927
|
-
socketPath: defaultToConfig2,
|
|
17928
|
-
responseEncoding: defaultToConfig2,
|
|
17929
|
-
validateStatus: mergeDirectKeys,
|
|
17930
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
17931
|
-
};
|
|
17932
|
-
|
|
17933
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
17934
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
17935
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
17936
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
17937
|
-
});
|
|
17938
|
-
|
|
17939
|
-
return config;
|
|
17940
|
-
}
|
|
17941
|
-
|
|
17942
18326
|
const validators$1 = {};
|
|
17943
18327
|
|
|
17944
18328
|
// eslint-disable-next-line func-names
|
|
@@ -18063,12 +18447,15 @@ class Axios {
|
|
|
18063
18447
|
|
|
18064
18448
|
// slice off the Error: ... line
|
|
18065
18449
|
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18450
|
+
try {
|
|
18451
|
+
if (!err.stack) {
|
|
18452
|
+
err.stack = stack;
|
|
18453
|
+
// match without the 2 top stack lines
|
|
18454
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
18455
|
+
err.stack += '\n' + stack;
|
|
18456
|
+
}
|
|
18457
|
+
} catch (e) {
|
|
18458
|
+
// ignore the case where "stack" is an un-writable property
|
|
18072
18459
|
}
|
|
18073
18460
|
}
|
|
18074
18461
|
|