axios 0.31.1 → 0.32.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/AGENTS.md +38 -0
- package/CHANGELOG.md +10 -0
- package/CLAUDE.md +1 -0
- package/README.md +24 -4
- package/dist/axios.js +276 -77
- package/dist/axios.js.map +1 -1
- package/dist/axios.min.js +1 -1
- package/dist/axios.min.js.map +1 -1
- package/dist/esm/axios.js +276 -77
- package/dist/esm/axios.js.map +1 -1
- package/dist/esm/axios.min.js +1 -1
- package/dist/esm/axios.min.js.map +1 -1
- package/index.d.ts +3 -0
- package/lib/adapters/http.js +291 -82
- package/lib/adapters/xhr.js +103 -33
- package/lib/core/AxiosError.js +79 -4
- package/lib/core/dispatchRequest.js +10 -5
- package/lib/core/mergeConfig.js +1 -0
- package/lib/defaults/index.js +3 -0
- package/lib/env/data.js +1 -1
- package/lib/helpers/AxiosURLSearchParams.js +18 -11
- package/lib/helpers/cookies.js +15 -2
- package/lib/helpers/defaultRedactKeys.js +3 -0
- package/lib/helpers/shouldBypassProxy.js +55 -1
- package/lib/utils.js +46 -21
- package/package.json +1 -1
package/dist/axios.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// axios v0.
|
|
1
|
+
// axios v0.32.0 Copyright (c) 2026 Matt Zabriskie
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -58,8 +58,14 @@
|
|
|
58
58
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
59
59
|
*/
|
|
60
60
|
function isBuffer(val) {
|
|
61
|
-
return
|
|
62
|
-
|
|
61
|
+
return (
|
|
62
|
+
val !== null &&
|
|
63
|
+
!isUndefined(val) &&
|
|
64
|
+
val.constructor !== null &&
|
|
65
|
+
!isUndefined(val.constructor) &&
|
|
66
|
+
typeof val.constructor.isBuffer === 'function' &&
|
|
67
|
+
val.constructor.isBuffer(val)
|
|
68
|
+
);
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
/**
|
|
@@ -71,7 +77,6 @@
|
|
|
71
77
|
*/
|
|
72
78
|
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
73
79
|
|
|
74
|
-
|
|
75
80
|
/**
|
|
76
81
|
* Determine if a value is a view on an ArrayBuffer
|
|
77
82
|
*
|
|
@@ -80,10 +85,10 @@
|
|
|
80
85
|
*/
|
|
81
86
|
function isArrayBufferView(val) {
|
|
82
87
|
var result;
|
|
83
|
-
if (
|
|
88
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
84
89
|
result = ArrayBuffer.isView(val);
|
|
85
90
|
} else {
|
|
86
|
-
result =
|
|
91
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
87
92
|
}
|
|
88
93
|
return result;
|
|
89
94
|
}
|
|
@@ -220,12 +225,14 @@
|
|
|
220
225
|
// Reject non-objects (strings, numbers, booleans) up front — Object.getPrototypeOf
|
|
221
226
|
// throws a TypeError on primitives in ES5 environments.
|
|
222
227
|
if (!isObject(thing)) return false;
|
|
223
|
-
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData
|
|
228
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
224
229
|
var proto = Object.getPrototypeOf(thing);
|
|
225
230
|
if (!proto || proto === Object.prototype) return false;
|
|
226
231
|
if (!isFunction(thing.append)) return false;
|
|
227
|
-
return
|
|
228
|
-
|
|
232
|
+
return (
|
|
233
|
+
toString.call(thing) === pattern ||
|
|
234
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
235
|
+
);
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
/**
|
|
@@ -243,7 +250,9 @@
|
|
|
243
250
|
* @returns {String} The String freed of excess whitespace
|
|
244
251
|
*/
|
|
245
252
|
function trim(str) {
|
|
246
|
-
return str.trim
|
|
253
|
+
return str.trim
|
|
254
|
+
? str.trim()
|
|
255
|
+
: str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
/**
|
|
@@ -263,10 +272,11 @@
|
|
|
263
272
|
*/
|
|
264
273
|
function isStandardBrowserEnv() {
|
|
265
274
|
var product;
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
product === '
|
|
269
|
-
|
|
275
|
+
if (
|
|
276
|
+
typeof navigator !== 'undefined' &&
|
|
277
|
+
((product = navigator.product) === 'ReactNative' ||
|
|
278
|
+
product === 'NativeScript' ||
|
|
279
|
+
product === 'NS')
|
|
270
280
|
) {
|
|
271
281
|
return false;
|
|
272
282
|
}
|
|
@@ -331,14 +341,20 @@
|
|
|
331
341
|
* @returns {Object} Result of all merge properties
|
|
332
342
|
*/
|
|
333
343
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
334
|
-
var result =
|
|
344
|
+
var result = Object.create(null);
|
|
335
345
|
function assignValue(val, key) {
|
|
346
|
+
var target;
|
|
347
|
+
|
|
336
348
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
337
349
|
return;
|
|
338
350
|
}
|
|
339
351
|
|
|
340
|
-
|
|
341
|
-
|
|
352
|
+
target = Object.prototype.hasOwnProperty.call(result, key)
|
|
353
|
+
? result[key]
|
|
354
|
+
: undefined;
|
|
355
|
+
|
|
356
|
+
if (isPlainObject(target) && isPlainObject(val)) {
|
|
357
|
+
result[key] = merge(target, val);
|
|
342
358
|
} else if (isPlainObject(val)) {
|
|
343
359
|
result[key] = merge({}, val);
|
|
344
360
|
} else if (isArray(val)) {
|
|
@@ -380,7 +396,7 @@
|
|
|
380
396
|
* @return {string} content value without BOM
|
|
381
397
|
*/
|
|
382
398
|
function stripBOM(content) {
|
|
383
|
-
if (content.charCodeAt(0) ===
|
|
399
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
384
400
|
content = content.slice(1);
|
|
385
401
|
}
|
|
386
402
|
return content;
|
|
@@ -395,7 +411,10 @@
|
|
|
395
411
|
*/
|
|
396
412
|
|
|
397
413
|
function inherits(constructor, superConstructor, props, descriptors) {
|
|
398
|
-
constructor.prototype = Object.create(
|
|
414
|
+
constructor.prototype = Object.create(
|
|
415
|
+
superConstructor.prototype,
|
|
416
|
+
descriptors
|
|
417
|
+
);
|
|
399
418
|
constructor.prototype.constructor = constructor;
|
|
400
419
|
props && Object.assign(constructor.prototype, props);
|
|
401
420
|
}
|
|
@@ -424,13 +443,20 @@
|
|
|
424
443
|
i = props.length;
|
|
425
444
|
while (i-- > 0) {
|
|
426
445
|
prop = props[i];
|
|
427
|
-
if (
|
|
446
|
+
if (
|
|
447
|
+
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
448
|
+
!merged[prop]
|
|
449
|
+
) {
|
|
428
450
|
destObj[prop] = sourceObj[prop];
|
|
429
451
|
merged[prop] = true;
|
|
430
452
|
}
|
|
431
453
|
}
|
|
432
454
|
sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
|
|
433
|
-
} while (
|
|
455
|
+
} while (
|
|
456
|
+
sourceObj &&
|
|
457
|
+
(!filter || filter(sourceObj, destObj)) &&
|
|
458
|
+
sourceObj !== Object.prototype
|
|
459
|
+
);
|
|
434
460
|
|
|
435
461
|
return destObj;
|
|
436
462
|
}
|
|
@@ -452,7 +478,6 @@
|
|
|
452
478
|
return lastIndex !== -1 && lastIndex === position;
|
|
453
479
|
}
|
|
454
480
|
|
|
455
|
-
|
|
456
481
|
/**
|
|
457
482
|
* Returns new array from array like object or null if failed
|
|
458
483
|
* @param {*} [thing]
|
|
@@ -548,6 +573,82 @@
|
|
|
548
573
|
hasOwnProperty: hasOwnProperty
|
|
549
574
|
};
|
|
550
575
|
|
|
576
|
+
var defaultRedactKeys = ['authorization', 'proxy-authorization', 'cookie', 'set-cookie', 'x-api-key', 'password'];
|
|
577
|
+
|
|
578
|
+
var REDACTED_VALUE = '[REDACTED ****]';
|
|
579
|
+
|
|
580
|
+
function makeValueDescriptor(value) {
|
|
581
|
+
var descriptor = Object.create(null);
|
|
582
|
+
descriptor.value = value;
|
|
583
|
+
return descriptor;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function getRedactKeys(config) {
|
|
587
|
+
// An empty array is treated as "no override" so an upstream `redact: []` cannot
|
|
588
|
+
// silently disable redaction. To opt out, pass non-string values or unset keys.
|
|
589
|
+
var override = config && utils.isArray(config.redact) && config.redact.length ? config.redact : null;
|
|
590
|
+
var redact = override || defaultRedactKeys;
|
|
591
|
+
var keys = {};
|
|
592
|
+
|
|
593
|
+
utils.forEach(redact, function eachRedactKey(key) {
|
|
594
|
+
if (typeof key === 'string') {
|
|
595
|
+
keys[key.toLowerCase()] = true;
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
return keys;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function shouldRedact(key, keys) {
|
|
603
|
+
return typeof key === 'string' && keys[key.toLowerCase()];
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
var CIRCULAR_VALUE = '[Circular]';
|
|
607
|
+
|
|
608
|
+
function serializeConfigValue(value, keys, key, seen) {
|
|
609
|
+
var result;
|
|
610
|
+
|
|
611
|
+
if (shouldRedact(key, keys)) {
|
|
612
|
+
return REDACTED_VALUE;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (utils.isArray(value)) {
|
|
616
|
+
if (seen.indexOf(value) !== -1) {
|
|
617
|
+
return CIRCULAR_VALUE;
|
|
618
|
+
}
|
|
619
|
+
seen.push(value);
|
|
620
|
+
result = [];
|
|
621
|
+
utils.forEach(value, function eachArrayValue(item, index) {
|
|
622
|
+
result[index] = serializeConfigValue(item, keys, index, seen);
|
|
623
|
+
});
|
|
624
|
+
seen.pop();
|
|
625
|
+
return result;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (utils.isPlainObject(value)) {
|
|
629
|
+
if (seen.indexOf(value) !== -1) {
|
|
630
|
+
return CIRCULAR_VALUE;
|
|
631
|
+
}
|
|
632
|
+
seen.push(value);
|
|
633
|
+
result = {};
|
|
634
|
+
utils.forEach(value, function eachObjectValue(item, itemKey) {
|
|
635
|
+
result[itemKey] = serializeConfigValue(item, keys, itemKey, seen);
|
|
636
|
+
});
|
|
637
|
+
seen.pop();
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return value;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function serializeConfig(config) {
|
|
645
|
+
if (!config) {
|
|
646
|
+
return config;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return serializeConfigValue(config, getRedactKeys(config), undefined, []);
|
|
650
|
+
}
|
|
651
|
+
|
|
551
652
|
/**
|
|
552
653
|
* Create an Error with the specified message, config, error code, request and response.
|
|
553
654
|
*
|
|
@@ -590,7 +691,7 @@
|
|
|
590
691
|
columnNumber: this.columnNumber,
|
|
591
692
|
stack: this.stack,
|
|
592
693
|
// Axios
|
|
593
|
-
config: this.config,
|
|
694
|
+
config: serializeConfig(this.config),
|
|
594
695
|
code: this.code,
|
|
595
696
|
status: this.response && this.response.status ? this.response.status : null
|
|
596
697
|
};
|
|
@@ -598,7 +699,7 @@
|
|
|
598
699
|
});
|
|
599
700
|
|
|
600
701
|
var prototype$1 = AxiosError.prototype;
|
|
601
|
-
var descriptors =
|
|
702
|
+
var descriptors = Object.create(null);
|
|
602
703
|
|
|
603
704
|
[
|
|
604
705
|
'ERR_BAD_OPTION_VALUE',
|
|
@@ -616,11 +717,11 @@
|
|
|
616
717
|
'ERR_FORM_DATA_DEPTH_EXCEEDED'
|
|
617
718
|
// eslint-disable-next-line func-names
|
|
618
719
|
].forEach(function(code) {
|
|
619
|
-
descriptors[code] =
|
|
720
|
+
descriptors[code] = makeValueDescriptor(code);
|
|
620
721
|
});
|
|
621
722
|
|
|
622
723
|
Object.defineProperties(AxiosError, descriptors);
|
|
623
|
-
Object.defineProperty(prototype$1, 'isAxiosError',
|
|
724
|
+
Object.defineProperty(prototype$1, 'isAxiosError', makeValueDescriptor(true));
|
|
624
725
|
|
|
625
726
|
// eslint-disable-next-line func-names
|
|
626
727
|
AxiosError.from = function(error, code, config, request, response, customProps) {
|
|
@@ -835,7 +936,7 @@
|
|
|
835
936
|
var toFormData_1 = toFormData;
|
|
836
937
|
|
|
837
938
|
function encode$1(str) {
|
|
838
|
-
// Do not map `%00` back to a raw null byte
|
|
939
|
+
// Do not map `%00` back to a raw null byte: that reversed
|
|
839
940
|
// the safe percent-encoding from encodeURIComponent and enabled null byte injection.
|
|
840
941
|
var charMap = {
|
|
841
942
|
'!': '%21',
|
|
@@ -845,9 +946,12 @@
|
|
|
845
946
|
'~': '%7E',
|
|
846
947
|
'%20': '+'
|
|
847
948
|
};
|
|
848
|
-
return encodeURIComponent(str).replace(
|
|
849
|
-
|
|
850
|
-
|
|
949
|
+
return encodeURIComponent(str).replace(
|
|
950
|
+
/[!'\(\)~]|%20/g,
|
|
951
|
+
function replacer(match) {
|
|
952
|
+
return charMap[match];
|
|
953
|
+
}
|
|
954
|
+
);
|
|
851
955
|
}
|
|
852
956
|
|
|
853
957
|
function AxiosURLSearchParams(params, options) {
|
|
@@ -863,13 +967,17 @@
|
|
|
863
967
|
};
|
|
864
968
|
|
|
865
969
|
prototype.toString = function toString(encoder) {
|
|
866
|
-
var _encode = encoder
|
|
867
|
-
|
|
868
|
-
|
|
970
|
+
var _encode = encoder
|
|
971
|
+
? function(value) {
|
|
972
|
+
return encoder.call(this, value, encode$1);
|
|
973
|
+
}
|
|
974
|
+
: encode$1;
|
|
869
975
|
|
|
870
|
-
return this._pairs
|
|
871
|
-
|
|
872
|
-
|
|
976
|
+
return this._pairs
|
|
977
|
+
.map(function each(pair) {
|
|
978
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
979
|
+
}, '')
|
|
980
|
+
.join('&');
|
|
873
981
|
};
|
|
874
982
|
|
|
875
983
|
var AxiosURLSearchParams_1 = AxiosURLSearchParams;
|
|
@@ -1152,8 +1260,21 @@
|
|
|
1152
1260
|
},
|
|
1153
1261
|
|
|
1154
1262
|
read: function read(name) {
|
|
1155
|
-
var
|
|
1156
|
-
|
|
1263
|
+
var nameEQ = name + '=';
|
|
1264
|
+
var cookies = document.cookie.split(';');
|
|
1265
|
+
var cookie;
|
|
1266
|
+
|
|
1267
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
1268
|
+
cookie = cookies[i];
|
|
1269
|
+
while (cookie.charAt(0) === ' ') {
|
|
1270
|
+
cookie = cookie.substring(1);
|
|
1271
|
+
}
|
|
1272
|
+
if (cookie.indexOf(nameEQ) === 0) {
|
|
1273
|
+
return decodeURIComponent(cookie.substring(nameEQ.length));
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
return null;
|
|
1157
1278
|
},
|
|
1158
1279
|
|
|
1159
1280
|
remove: function remove(name) {
|
|
@@ -1362,8 +1483,10 @@
|
|
|
1362
1483
|
var requestData = config.data;
|
|
1363
1484
|
var requestHeaders = config.headers;
|
|
1364
1485
|
var responseType = config.responseType;
|
|
1365
|
-
// Guard against prototype pollution
|
|
1366
|
-
var withXSRFToken = utils.hasOwnProperty(config, 'withXSRFToken')
|
|
1486
|
+
// Guard against prototype pollution: only honor own properties.
|
|
1487
|
+
var withXSRFToken = utils.hasOwnProperty(config, 'withXSRFToken')
|
|
1488
|
+
? config.withXSRFToken
|
|
1489
|
+
: undefined;
|
|
1367
1490
|
var onCanceled;
|
|
1368
1491
|
function done() {
|
|
1369
1492
|
if (config.cancelToken) {
|
|
@@ -1384,13 +1507,23 @@
|
|
|
1384
1507
|
// HTTP basic authentication
|
|
1385
1508
|
if (config.auth) {
|
|
1386
1509
|
var username = config.auth.username || '';
|
|
1387
|
-
var password = config.auth.password
|
|
1510
|
+
var password = config.auth.password
|
|
1511
|
+
? unescape(encodeURIComponent(config.auth.password))
|
|
1512
|
+
: '';
|
|
1388
1513
|
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
1389
1514
|
}
|
|
1390
1515
|
|
|
1391
|
-
var fullPath = buildFullPath(
|
|
1516
|
+
var fullPath = buildFullPath(
|
|
1517
|
+
config.baseURL,
|
|
1518
|
+
config.url,
|
|
1519
|
+
config.allowAbsoluteUrls
|
|
1520
|
+
);
|
|
1392
1521
|
|
|
1393
|
-
request.open(
|
|
1522
|
+
request.open(
|
|
1523
|
+
config.method.toUpperCase(),
|
|
1524
|
+
buildURL(fullPath, config.params, config.paramsSerializer),
|
|
1525
|
+
true
|
|
1526
|
+
);
|
|
1394
1527
|
|
|
1395
1528
|
// Set the request timeout in MS
|
|
1396
1529
|
request.timeout = config.timeout;
|
|
@@ -1400,9 +1533,14 @@
|
|
|
1400
1533
|
return;
|
|
1401
1534
|
}
|
|
1402
1535
|
// Prepare the response
|
|
1403
|
-
var responseHeaders =
|
|
1404
|
-
|
|
1405
|
-
|
|
1536
|
+
var responseHeaders =
|
|
1537
|
+
'getAllResponseHeaders' in request
|
|
1538
|
+
? parseHeaders(request.getAllResponseHeaders())
|
|
1539
|
+
: null;
|
|
1540
|
+
var responseData =
|
|
1541
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
1542
|
+
? request.responseText
|
|
1543
|
+
: request.response;
|
|
1406
1544
|
var response = {
|
|
1407
1545
|
data: responseData,
|
|
1408
1546
|
status: request.status,
|
|
@@ -1412,13 +1550,17 @@
|
|
|
1412
1550
|
request: request
|
|
1413
1551
|
};
|
|
1414
1552
|
|
|
1415
|
-
settle(
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1553
|
+
settle(
|
|
1554
|
+
function _resolve(value) {
|
|
1555
|
+
resolve(value);
|
|
1556
|
+
done();
|
|
1557
|
+
},
|
|
1558
|
+
function _reject(err) {
|
|
1559
|
+
reject(err);
|
|
1560
|
+
done();
|
|
1561
|
+
},
|
|
1562
|
+
response
|
|
1563
|
+
);
|
|
1422
1564
|
|
|
1423
1565
|
// Clean up request
|
|
1424
1566
|
request = null;
|
|
@@ -1438,7 +1580,10 @@
|
|
|
1438
1580
|
// handled by onerror instead
|
|
1439
1581
|
// With one exception: request that using file: protocol, most browsers
|
|
1440
1582
|
// will return status as 0 even though it's a successful request
|
|
1441
|
-
if (
|
|
1583
|
+
if (
|
|
1584
|
+
request.status === 0 &&
|
|
1585
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
1586
|
+
) {
|
|
1442
1587
|
return;
|
|
1443
1588
|
}
|
|
1444
1589
|
// readystate handler is calling before onerror or ontimeout handlers,
|
|
@@ -1453,7 +1598,14 @@
|
|
|
1453
1598
|
return;
|
|
1454
1599
|
}
|
|
1455
1600
|
|
|
1456
|
-
reject(
|
|
1601
|
+
reject(
|
|
1602
|
+
new AxiosError_1(
|
|
1603
|
+
'Request aborted',
|
|
1604
|
+
AxiosError_1.ECONNABORTED,
|
|
1605
|
+
config,
|
|
1606
|
+
request
|
|
1607
|
+
)
|
|
1608
|
+
);
|
|
1457
1609
|
|
|
1458
1610
|
// Clean up request
|
|
1459
1611
|
request = null;
|
|
@@ -1463,7 +1615,14 @@
|
|
|
1463
1615
|
request.onerror = function handleError() {
|
|
1464
1616
|
// Real errors are hidden from us by the browser
|
|
1465
1617
|
// onerror should only fire if it's a network error
|
|
1466
|
-
reject(
|
|
1618
|
+
reject(
|
|
1619
|
+
new AxiosError_1(
|
|
1620
|
+
'Network Error',
|
|
1621
|
+
AxiosError_1.ERR_NETWORK,
|
|
1622
|
+
config,
|
|
1623
|
+
request
|
|
1624
|
+
)
|
|
1625
|
+
);
|
|
1467
1626
|
|
|
1468
1627
|
// Clean up request
|
|
1469
1628
|
request = null;
|
|
@@ -1471,16 +1630,23 @@
|
|
|
1471
1630
|
|
|
1472
1631
|
// Handle timeout
|
|
1473
1632
|
request.ontimeout = function handleTimeout() {
|
|
1474
|
-
var timeoutErrorMessage = config.timeout
|
|
1633
|
+
var timeoutErrorMessage = config.timeout
|
|
1634
|
+
? 'timeout of ' + config.timeout + 'ms exceeded'
|
|
1635
|
+
: 'timeout exceeded';
|
|
1475
1636
|
var transitional$1 = config.transitional || transitional;
|
|
1476
1637
|
if (config.timeoutErrorMessage) {
|
|
1477
1638
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
1478
1639
|
}
|
|
1479
|
-
reject(
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1640
|
+
reject(
|
|
1641
|
+
new AxiosError_1(
|
|
1642
|
+
timeoutErrorMessage,
|
|
1643
|
+
transitional$1.clarifyTimeoutError
|
|
1644
|
+
? AxiosError_1.ETIMEDOUT
|
|
1645
|
+
: AxiosError_1.ECONNABORTED,
|
|
1646
|
+
config,
|
|
1647
|
+
request
|
|
1648
|
+
)
|
|
1649
|
+
);
|
|
1484
1650
|
|
|
1485
1651
|
// Clean up request
|
|
1486
1652
|
request = null;
|
|
@@ -1494,10 +1660,16 @@
|
|
|
1494
1660
|
if (utils.isFunction(withXSRFToken)) {
|
|
1495
1661
|
withXSRFToken = withXSRFToken(config);
|
|
1496
1662
|
}
|
|
1497
|
-
// Strict boolean check
|
|
1498
|
-
if (
|
|
1663
|
+
// Strict boolean check: only `true` short-circuits the same-origin guard.
|
|
1664
|
+
if (
|
|
1665
|
+
withXSRFToken === true ||
|
|
1666
|
+
(withXSRFToken !== false && isURLSameOrigin(fullPath))
|
|
1667
|
+
) {
|
|
1499
1668
|
// Add xsrf header
|
|
1500
|
-
var xsrfValue =
|
|
1669
|
+
var xsrfValue =
|
|
1670
|
+
config.xsrfHeaderName &&
|
|
1671
|
+
config.xsrfCookieName &&
|
|
1672
|
+
cookies.read(config.xsrfCookieName);
|
|
1501
1673
|
if (xsrfValue) {
|
|
1502
1674
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
1503
1675
|
}
|
|
@@ -1507,7 +1679,10 @@
|
|
|
1507
1679
|
// Add headers to the request
|
|
1508
1680
|
if ('setRequestHeader' in request) {
|
|
1509
1681
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
1510
|
-
if (
|
|
1682
|
+
if (
|
|
1683
|
+
typeof requestData === 'undefined' &&
|
|
1684
|
+
key.toLowerCase() === 'content-type'
|
|
1685
|
+
) {
|
|
1511
1686
|
// Remove Content-Type if data is undefined
|
|
1512
1687
|
delete requestHeaders[key];
|
|
1513
1688
|
} else {
|
|
@@ -1544,30 +1719,46 @@
|
|
|
1544
1719
|
if (!request) {
|
|
1545
1720
|
return;
|
|
1546
1721
|
}
|
|
1547
|
-
reject(
|
|
1722
|
+
reject(
|
|
1723
|
+
!cancel || cancel.type
|
|
1724
|
+
? new CanceledError_1(null, config, request)
|
|
1725
|
+
: cancel
|
|
1726
|
+
);
|
|
1548
1727
|
request.abort();
|
|
1549
1728
|
request = null;
|
|
1550
1729
|
};
|
|
1551
1730
|
|
|
1552
1731
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
1553
1732
|
if (config.signal) {
|
|
1554
|
-
config.signal.aborted
|
|
1733
|
+
config.signal.aborted
|
|
1734
|
+
? onCanceled()
|
|
1735
|
+
: config.signal.addEventListener('abort', onCanceled);
|
|
1555
1736
|
}
|
|
1556
1737
|
}
|
|
1557
1738
|
|
|
1558
1739
|
// false, 0 (zero number), and '' (empty string) are valid JSON values
|
|
1559
|
-
if (
|
|
1740
|
+
if (
|
|
1741
|
+
!requestData &&
|
|
1742
|
+
requestData !== false &&
|
|
1743
|
+
requestData !== 0 &&
|
|
1744
|
+
requestData !== ''
|
|
1745
|
+
) {
|
|
1560
1746
|
requestData = null;
|
|
1561
1747
|
}
|
|
1562
1748
|
|
|
1563
1749
|
var protocol = parseProtocol(fullPath);
|
|
1564
1750
|
|
|
1565
1751
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
1566
|
-
reject(
|
|
1752
|
+
reject(
|
|
1753
|
+
new AxiosError_1(
|
|
1754
|
+
'Unsupported protocol ' + protocol + ':',
|
|
1755
|
+
AxiosError_1.ERR_BAD_REQUEST,
|
|
1756
|
+
config
|
|
1757
|
+
)
|
|
1758
|
+
);
|
|
1567
1759
|
return;
|
|
1568
1760
|
}
|
|
1569
1761
|
|
|
1570
|
-
|
|
1571
1762
|
// Send the request
|
|
1572
1763
|
request.send(requestData);
|
|
1573
1764
|
});
|
|
@@ -1715,6 +1906,8 @@
|
|
|
1715
1906
|
maxContentLength: -1,
|
|
1716
1907
|
maxBodyLength: -1,
|
|
1717
1908
|
|
|
1909
|
+
redact: defaultRedactKeys.slice(),
|
|
1910
|
+
|
|
1718
1911
|
env: {
|
|
1719
1912
|
FormData: platform.classes.FormData,
|
|
1720
1913
|
Blob: platform.classes.Blob
|
|
@@ -1821,11 +2014,16 @@
|
|
|
1821
2014
|
normalizeHeaderName(config.headers, 'Content-Type');
|
|
1822
2015
|
|
|
1823
2016
|
// Flatten headers
|
|
1824
|
-
config.headers
|
|
1825
|
-
config.headers.common
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
2017
|
+
var commonHeaders = utils.hasOwnProperty(config.headers, 'common') && config.headers.common
|
|
2018
|
+
? config.headers.common
|
|
2019
|
+
: {};
|
|
2020
|
+
var methodHeaders = config.method &&
|
|
2021
|
+
utils.hasOwnProperty(config.headers, config.method) &&
|
|
2022
|
+
config.headers[config.method]
|
|
2023
|
+
? config.headers[config.method]
|
|
2024
|
+
: {};
|
|
2025
|
+
|
|
2026
|
+
config.headers = utils.merge(commonHeaders, methodHeaders, config.headers);
|
|
1829
2027
|
|
|
1830
2028
|
utils.forEach(
|
|
1831
2029
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
@@ -1970,6 +2168,7 @@
|
|
|
1970
2168
|
'httpsAgent': defaultToConfig2,
|
|
1971
2169
|
'cancelToken': defaultToConfig2,
|
|
1972
2170
|
'socketPath': defaultToConfig2,
|
|
2171
|
+
'allowedSocketPaths': defaultToConfig2,
|
|
1973
2172
|
'responseEncoding': defaultToConfig2,
|
|
1974
2173
|
'validateStatus': mergeDirectKeys
|
|
1975
2174
|
};
|
|
@@ -1987,7 +2186,7 @@
|
|
|
1987
2186
|
};
|
|
1988
2187
|
|
|
1989
2188
|
var data = {
|
|
1990
|
-
"version": "0.
|
|
2189
|
+
"version": "0.32.0"
|
|
1991
2190
|
};
|
|
1992
2191
|
|
|
1993
2192
|
var VERSION = data.version;
|