superagent 8.0.8 → 8.1.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/dist/superagent.js +97 -60
- package/dist/superagent.min.js +1 -1
- package/lib/agent-base.js +1 -1
- package/lib/client.js +5 -5
- package/lib/node/agent.js +2 -2
- package/lib/node/http2wrapper.js +144 -134
- package/lib/node/index.js +29 -16
- package/lib/node/response.js +4 -4
- package/lib/node/unzip.js +4 -4
- package/lib/request-base.js +36 -23
- package/lib/response-base.js +1 -1
- package/lib/utils.js +1 -1
- package/package.json +14 -14
package/dist/superagent.js
CHANGED
|
@@ -406,16 +406,17 @@ var ThrowTypeError = $gOPD ? function () {
|
|
|
406
406
|
}
|
|
407
407
|
}() : throwTypeError;
|
|
408
408
|
var hasSymbols = require('has-symbols')();
|
|
409
|
-
var
|
|
409
|
+
var hasProto = require('has-proto')();
|
|
410
|
+
var getProto = Object.getPrototypeOf || (hasProto ? function (x) {
|
|
410
411
|
return x.__proto__;
|
|
411
|
-
};
|
|
412
|
+
} : null);
|
|
412
413
|
var needsEval = {};
|
|
413
|
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
|
414
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
|
|
414
415
|
var INTRINSICS = {
|
|
415
416
|
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
|
416
417
|
'%Array%': Array,
|
|
417
418
|
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
|
418
|
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
|
419
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
|
|
419
420
|
'%AsyncFromSyncIteratorPrototype%': undefined,
|
|
420
421
|
'%AsyncFunction%': needsEval,
|
|
421
422
|
'%AsyncGenerator%': needsEval,
|
|
@@ -423,6 +424,8 @@ var INTRINSICS = {
|
|
|
423
424
|
'%AsyncIteratorPrototype%': needsEval,
|
|
424
425
|
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
|
425
426
|
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
|
427
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
|
428
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
|
426
429
|
'%Boolean%': Boolean,
|
|
427
430
|
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
|
428
431
|
'%Date%': Date,
|
|
@@ -443,10 +446,10 @@ var INTRINSICS = {
|
|
|
443
446
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
|
444
447
|
'%isFinite%': isFinite,
|
|
445
448
|
'%isNaN%': isNaN,
|
|
446
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
449
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
447
450
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
|
448
451
|
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
|
449
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
452
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
450
453
|
'%Math%': Math,
|
|
451
454
|
'%Number%': Number,
|
|
452
455
|
'%Object%': Object,
|
|
@@ -459,10 +462,10 @@ var INTRINSICS = {
|
|
|
459
462
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
|
460
463
|
'%RegExp%': RegExp,
|
|
461
464
|
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
|
462
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
465
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
463
466
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
|
464
467
|
'%String%': String,
|
|
465
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
|
468
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
|
|
466
469
|
'%Symbol%': hasSymbols ? Symbol : undefined,
|
|
467
470
|
'%SyntaxError%': $SyntaxError,
|
|
468
471
|
'%ThrowTypeError%': ThrowTypeError,
|
|
@@ -477,6 +480,14 @@ var INTRINSICS = {
|
|
|
477
480
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
478
481
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
479
482
|
};
|
|
483
|
+
if (getProto) {
|
|
484
|
+
try {
|
|
485
|
+
null.error;
|
|
486
|
+
} catch (e) {
|
|
487
|
+
var errorProto = getProto(getProto(e));
|
|
488
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
480
491
|
var doEval = function doEval(name) {
|
|
481
492
|
var value;
|
|
482
493
|
if (name === '%AsyncFunction%') {
|
|
@@ -492,7 +503,7 @@ var doEval = function doEval(name) {
|
|
|
492
503
|
}
|
|
493
504
|
} else if (name === '%AsyncIteratorPrototype%') {
|
|
494
505
|
var gen = doEval('%AsyncGenerator%');
|
|
495
|
-
if (gen) {
|
|
506
|
+
if (gen && getProto) {
|
|
496
507
|
value = getProto(gen.prototype);
|
|
497
508
|
}
|
|
498
509
|
}
|
|
@@ -660,7 +671,22 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
660
671
|
return value;
|
|
661
672
|
};
|
|
662
673
|
|
|
663
|
-
},{"function-bind":7,"has":
|
|
674
|
+
},{"function-bind":7,"has":12,"has-proto":9,"has-symbols":10}],9:[function(require,module,exports){
|
|
675
|
+
'use strict';
|
|
676
|
+
|
|
677
|
+
var test = {
|
|
678
|
+
foo: {}
|
|
679
|
+
};
|
|
680
|
+
var $Object = Object;
|
|
681
|
+
module.exports = function hasProto() {
|
|
682
|
+
return {
|
|
683
|
+
__proto__: test
|
|
684
|
+
}.foo === test.foo && !({
|
|
685
|
+
__proto__: null
|
|
686
|
+
} instanceof $Object);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
},{}],10:[function(require,module,exports){
|
|
664
690
|
'use strict';
|
|
665
691
|
|
|
666
692
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
@@ -681,7 +707,7 @@ module.exports = function hasNativeSymbols() {
|
|
|
681
707
|
return hasSymbolSham();
|
|
682
708
|
};
|
|
683
709
|
|
|
684
|
-
},{"./shams":
|
|
710
|
+
},{"./shams":11}],11:[function(require,module,exports){
|
|
685
711
|
'use strict';
|
|
686
712
|
module.exports = function hasSymbols() {
|
|
687
713
|
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
|
|
@@ -729,13 +755,13 @@ module.exports = function hasSymbols() {
|
|
|
729
755
|
return true;
|
|
730
756
|
};
|
|
731
757
|
|
|
732
|
-
},{}],
|
|
758
|
+
},{}],12:[function(require,module,exports){
|
|
733
759
|
'use strict';
|
|
734
760
|
|
|
735
761
|
var bind = require('function-bind');
|
|
736
762
|
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
737
763
|
|
|
738
|
-
},{"function-bind":7}],
|
|
764
|
+
},{"function-bind":7}],13:[function(require,module,exports){
|
|
739
765
|
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
740
766
|
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
741
767
|
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
@@ -1235,7 +1261,7 @@ function arrObjKeys(obj, inspect) {
|
|
|
1235
1261
|
return xs;
|
|
1236
1262
|
}
|
|
1237
1263
|
|
|
1238
|
-
},{"./util.inspect":1}],
|
|
1264
|
+
},{"./util.inspect":1}],14:[function(require,module,exports){
|
|
1239
1265
|
var process = module.exports = {};
|
|
1240
1266
|
var cachedSetTimeout;
|
|
1241
1267
|
var cachedClearTimeout;
|
|
@@ -1392,7 +1418,7 @@ process.umask = function () {
|
|
|
1392
1418
|
return 0;
|
|
1393
1419
|
};
|
|
1394
1420
|
|
|
1395
|
-
},{}],
|
|
1421
|
+
},{}],15:[function(require,module,exports){
|
|
1396
1422
|
'use strict';
|
|
1397
1423
|
|
|
1398
1424
|
var replace = String.prototype.replace;
|
|
@@ -1415,7 +1441,7 @@ module.exports = {
|
|
|
1415
1441
|
RFC3986: Format.RFC3986
|
|
1416
1442
|
};
|
|
1417
1443
|
|
|
1418
|
-
},{}],
|
|
1444
|
+
},{}],16:[function(require,module,exports){
|
|
1419
1445
|
'use strict';
|
|
1420
1446
|
|
|
1421
1447
|
var stringify = require('./stringify');
|
|
@@ -1427,7 +1453,7 @@ module.exports = {
|
|
|
1427
1453
|
stringify: stringify
|
|
1428
1454
|
};
|
|
1429
1455
|
|
|
1430
|
-
},{"./formats":
|
|
1456
|
+
},{"./formats":15,"./parse":17,"./stringify":18}],17:[function(require,module,exports){
|
|
1431
1457
|
'use strict';
|
|
1432
1458
|
|
|
1433
1459
|
var utils = require('./utils');
|
|
@@ -1465,7 +1491,9 @@ var parseArrayValue = function (val, options) {
|
|
|
1465
1491
|
var isoSentinel = 'utf8=%26%2310003%3B';
|
|
1466
1492
|
var charsetSentinel = 'utf8=%E2%9C%93';
|
|
1467
1493
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
1468
|
-
var obj = {
|
|
1494
|
+
var obj = {
|
|
1495
|
+
__proto__: null
|
|
1496
|
+
};
|
|
1469
1497
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
1470
1498
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
1471
1499
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
@@ -1624,7 +1652,7 @@ module.exports = function (str, opts) {
|
|
|
1624
1652
|
return utils.compact(obj);
|
|
1625
1653
|
};
|
|
1626
1654
|
|
|
1627
|
-
},{"./utils":
|
|
1655
|
+
},{"./utils":19}],18:[function(require,module,exports){
|
|
1628
1656
|
'use strict';
|
|
1629
1657
|
|
|
1630
1658
|
var getSideChannel = require('side-channel');
|
|
@@ -1644,7 +1672,6 @@ var arrayPrefixGenerators = {
|
|
|
1644
1672
|
}
|
|
1645
1673
|
};
|
|
1646
1674
|
var isArray = Array.isArray;
|
|
1647
|
-
var split = String.prototype.split;
|
|
1648
1675
|
var push = Array.prototype.push;
|
|
1649
1676
|
var pushToArray = function (arr, valueOrArray) {
|
|
1650
1677
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
@@ -1713,14 +1740,6 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1713
1740
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
1714
1741
|
if (encoder) {
|
|
1715
1742
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
1716
|
-
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
|
1717
|
-
var valuesArray = split.call(String(obj), ',');
|
|
1718
|
-
var valuesJoined = '';
|
|
1719
|
-
for (var i = 0; i < valuesArray.length; ++i) {
|
|
1720
|
-
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
1721
|
-
}
|
|
1722
|
-
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
|
1723
|
-
}
|
|
1724
1743
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
1725
1744
|
}
|
|
1726
1745
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
@@ -1731,6 +1750,9 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1731
1750
|
}
|
|
1732
1751
|
var objKeys;
|
|
1733
1752
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
1753
|
+
if (encodeValuesOnly && encoder) {
|
|
1754
|
+
obj = utils.maybeMap(obj, encoder);
|
|
1755
|
+
}
|
|
1734
1756
|
objKeys = [{
|
|
1735
1757
|
value: obj.length > 0 ? obj.join(',') || null : void undefined
|
|
1736
1758
|
}];
|
|
@@ -1751,7 +1773,7 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1751
1773
|
sideChannel.set(object, step);
|
|
1752
1774
|
var valueSideChannel = getSideChannel();
|
|
1753
1775
|
valueSideChannel.set(sentinel, sideChannel);
|
|
1754
|
-
pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
1776
|
+
pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, strictNullHandling, skipNulls, generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
1755
1777
|
}
|
|
1756
1778
|
return values;
|
|
1757
1779
|
};
|
|
@@ -1851,7 +1873,7 @@ module.exports = function (object, opts) {
|
|
|
1851
1873
|
return joined.length > 0 ? prefix + joined : '';
|
|
1852
1874
|
};
|
|
1853
1875
|
|
|
1854
|
-
},{"./formats":
|
|
1876
|
+
},{"./formats":15,"./utils":19,"side-channel":20}],19:[function(require,module,exports){
|
|
1855
1877
|
'use strict';
|
|
1856
1878
|
|
|
1857
1879
|
var formats = require('./formats');
|
|
@@ -2055,7 +2077,7 @@ module.exports = {
|
|
|
2055
2077
|
merge: merge
|
|
2056
2078
|
};
|
|
2057
2079
|
|
|
2058
|
-
},{"./formats":
|
|
2080
|
+
},{"./formats":15}],20:[function(require,module,exports){
|
|
2059
2081
|
'use strict';
|
|
2060
2082
|
|
|
2061
2083
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -2165,7 +2187,7 @@ module.exports = function getSideChannel() {
|
|
|
2165
2187
|
return channel;
|
|
2166
2188
|
};
|
|
2167
2189
|
|
|
2168
|
-
},{"call-bind/callBound":2,"get-intrinsic":8,"object-inspect":
|
|
2190
|
+
},{"call-bind/callBound":2,"get-intrinsic":8,"object-inspect":13}],21:[function(require,module,exports){
|
|
2169
2191
|
function Agent() {
|
|
2170
2192
|
this._defaults = [];
|
|
2171
2193
|
}
|
|
@@ -2188,7 +2210,7 @@ Agent.prototype._setDefaults = function (request) {
|
|
|
2188
2210
|
};
|
|
2189
2211
|
module.exports = Agent;
|
|
2190
2212
|
|
|
2191
|
-
},{}],
|
|
2213
|
+
},{}],22:[function(require,module,exports){
|
|
2192
2214
|
let root;
|
|
2193
2215
|
if (typeof window !== 'undefined') {
|
|
2194
2216
|
root = window;
|
|
@@ -2228,7 +2250,7 @@ request.getXHR = () => {
|
|
|
2228
2250
|
}
|
|
2229
2251
|
throw new Error('Browser-only version of superagent could not find XHR');
|
|
2230
2252
|
};
|
|
2231
|
-
const trim = ''.trim ? s => s.trim() : s => s.
|
|
2253
|
+
const trim = ''.trim ? s => s.trim() : s => s.replaceAll(/(^\s*|\s*$)/g, '');
|
|
2232
2254
|
function serialize(object) {
|
|
2233
2255
|
if (!isObject(object)) return object;
|
|
2234
2256
|
const pairs = [];
|
|
@@ -2314,7 +2336,7 @@ function isJSON(mime) {
|
|
|
2314
2336
|
function Response(request_) {
|
|
2315
2337
|
this.req = request_;
|
|
2316
2338
|
this.xhr = this.req.xhr;
|
|
2317
|
-
this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') ||
|
|
2339
|
+
this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || this.xhr.responseType === undefined ? this.xhr.responseText : null;
|
|
2318
2340
|
this.statusText = this.req.xhr.statusText;
|
|
2319
2341
|
let {
|
|
2320
2342
|
status
|
|
@@ -2379,7 +2401,7 @@ function Request(method, url) {
|
|
|
2379
2401
|
error.parse = true;
|
|
2380
2402
|
error.original = err;
|
|
2381
2403
|
if (self.xhr) {
|
|
2382
|
-
error.rawResponse =
|
|
2404
|
+
error.rawResponse = self.xhr.responseType === undefined ? self.xhr.responseText : self.xhr.response;
|
|
2383
2405
|
error.status = self.xhr.status ? self.xhr.status : null;
|
|
2384
2406
|
error.statusCode = error.status;
|
|
2385
2407
|
} else {
|
|
@@ -2584,7 +2606,7 @@ Request.prototype._end = function () {
|
|
|
2584
2606
|
xhr.responseType = this._responseType;
|
|
2585
2607
|
}
|
|
2586
2608
|
this.emit('request', this);
|
|
2587
|
-
xhr.send(
|
|
2609
|
+
xhr.send(data === undefined ? null : data);
|
|
2588
2610
|
};
|
|
2589
2611
|
request.agent = () => new Agent();
|
|
2590
2612
|
for (const method of ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE']) {
|
|
@@ -2671,7 +2693,7 @@ request.put = (url, data, fn) => {
|
|
|
2671
2693
|
return request_;
|
|
2672
2694
|
};
|
|
2673
2695
|
|
|
2674
|
-
},{"./agent-base":
|
|
2696
|
+
},{"./agent-base":21,"./request-base":23,"./response-base":24,"./utils":25,"component-emitter":4,"fast-safe-stringify":5,"qs":16}],23:[function(require,module,exports){
|
|
2675
2697
|
(function (process){(function (){
|
|
2676
2698
|
const semver = require('semver');
|
|
2677
2699
|
const {
|
|
@@ -2712,16 +2734,24 @@ RequestBase.prototype.timeout = function (options) {
|
|
|
2712
2734
|
if (hasOwn(options, option)) {
|
|
2713
2735
|
switch (option) {
|
|
2714
2736
|
case 'deadline':
|
|
2715
|
-
|
|
2716
|
-
|
|
2737
|
+
{
|
|
2738
|
+
this._timeout = options.deadline;
|
|
2739
|
+
break;
|
|
2740
|
+
}
|
|
2717
2741
|
case 'response':
|
|
2718
|
-
|
|
2719
|
-
|
|
2742
|
+
{
|
|
2743
|
+
this._responseTimeout = options.response;
|
|
2744
|
+
break;
|
|
2745
|
+
}
|
|
2720
2746
|
case 'upload':
|
|
2721
|
-
|
|
2722
|
-
|
|
2747
|
+
{
|
|
2748
|
+
this._uploadTimeout = options.upload;
|
|
2749
|
+
break;
|
|
2750
|
+
}
|
|
2723
2751
|
default:
|
|
2724
|
-
|
|
2752
|
+
{
|
|
2753
|
+
console.warn('Unknown timeout option', option);
|
|
2754
|
+
}
|
|
2725
2755
|
}
|
|
2726
2756
|
}
|
|
2727
2757
|
}
|
|
@@ -2876,8 +2906,6 @@ RequestBase.prototype.abort = function () {
|
|
|
2876
2906
|
if (this.req) {
|
|
2877
2907
|
if (semver.gte(process.version, 'v13.0.0') && semver.lt(process.version, 'v14.0.0')) {
|
|
2878
2908
|
throw new Error('Superagent does not work in v13 properly with abort() due to Node.js core changes');
|
|
2879
|
-
} else if (semver.gte(process.version, 'v14.0.0')) {
|
|
2880
|
-
this.req.destroyed = true;
|
|
2881
2909
|
}
|
|
2882
2910
|
this.req.abort();
|
|
2883
2911
|
}
|
|
@@ -2888,17 +2916,25 @@ RequestBase.prototype.abort = function () {
|
|
|
2888
2916
|
RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
|
|
2889
2917
|
switch (options.type) {
|
|
2890
2918
|
case 'basic':
|
|
2891
|
-
|
|
2892
|
-
|
|
2919
|
+
{
|
|
2920
|
+
this.set('Authorization', `Basic ${base64Encoder(`${user}:${pass}`)}`);
|
|
2921
|
+
break;
|
|
2922
|
+
}
|
|
2893
2923
|
case 'auto':
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2924
|
+
{
|
|
2925
|
+
this.username = user;
|
|
2926
|
+
this.password = pass;
|
|
2927
|
+
break;
|
|
2928
|
+
}
|
|
2897
2929
|
case 'bearer':
|
|
2898
|
-
|
|
2899
|
-
|
|
2930
|
+
{
|
|
2931
|
+
this.set('Authorization', `Bearer ${user}`);
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2900
2934
|
default:
|
|
2901
|
-
|
|
2935
|
+
{
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2902
2938
|
}
|
|
2903
2939
|
return this;
|
|
2904
2940
|
};
|
|
@@ -2943,9 +2979,10 @@ RequestBase.prototype.send = function (data) {
|
|
|
2943
2979
|
}
|
|
2944
2980
|
if (isObject_ && isObject(this._data)) {
|
|
2945
2981
|
for (const key in data) {
|
|
2982
|
+
if (typeof data[key] === 'bigint') throw new Error('Cannot serialize BigInt value to json');
|
|
2946
2983
|
if (hasOwn(data, key)) this._data[key] = data[key];
|
|
2947
2984
|
}
|
|
2948
|
-
} else if (typeof data === 'string') {
|
|
2985
|
+
} else if (typeof data === 'bigint') throw new Error('Cannot send value of type BigInt');else if (typeof data === 'string') {
|
|
2949
2986
|
if (!type) this.type('form');
|
|
2950
2987
|
type = this._header['content-type'];
|
|
2951
2988
|
if (type) type = type.toLowerCase().trim();
|
|
@@ -2964,7 +3001,7 @@ RequestBase.prototype.send = function (data) {
|
|
|
2964
3001
|
return this;
|
|
2965
3002
|
};
|
|
2966
3003
|
RequestBase.prototype.sortQuery = function (sort) {
|
|
2967
|
-
this._sort =
|
|
3004
|
+
this._sort = sort === undefined ? true : sort;
|
|
2968
3005
|
return this;
|
|
2969
3006
|
};
|
|
2970
3007
|
RequestBase.prototype._finalizeQueryString = function () {
|
|
@@ -3017,7 +3054,7 @@ RequestBase.prototype._setTimeouts = function () {
|
|
|
3017
3054
|
};
|
|
3018
3055
|
|
|
3019
3056
|
}).call(this)}).call(this,require('_process'))
|
|
3020
|
-
},{"./utils":
|
|
3057
|
+
},{"./utils":25,"_process":14,"semver":1}],24:[function(require,module,exports){
|
|
3021
3058
|
const utils = require('./utils');
|
|
3022
3059
|
module.exports = ResponseBase;
|
|
3023
3060
|
function ResponseBase() {}
|
|
@@ -3060,7 +3097,7 @@ ResponseBase.prototype._setStatusProperties = function (status) {
|
|
|
3060
3097
|
this.unprocessableEntity = status === 422;
|
|
3061
3098
|
};
|
|
3062
3099
|
|
|
3063
|
-
},{"./utils":
|
|
3100
|
+
},{"./utils":25}],25:[function(require,module,exports){
|
|
3064
3101
|
exports.type = string_ => string_.split(/ *; */).shift();
|
|
3065
3102
|
exports.params = value => {
|
|
3066
3103
|
const object = {};
|
|
@@ -3110,5 +3147,5 @@ exports.mixin = (target, source) => {
|
|
|
3110
3147
|
}
|
|
3111
3148
|
};
|
|
3112
3149
|
|
|
3113
|
-
},{}]},{},[
|
|
3150
|
+
},{}]},{},[22])(22)
|
|
3114
3151
|
});
|