superagent 8.0.9 → 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 +94 -65
- 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 +13 -13
- 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,
|
|
@@ -445,10 +446,10 @@ var INTRINSICS = {
|
|
|
445
446
|
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
|
446
447
|
'%isFinite%': isFinite,
|
|
447
448
|
'%isNaN%': isNaN,
|
|
448
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
449
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
449
450
|
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
|
450
451
|
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
|
451
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
452
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
452
453
|
'%Math%': Math,
|
|
453
454
|
'%Number%': Number,
|
|
454
455
|
'%Object%': Object,
|
|
@@ -461,10 +462,10 @@ var INTRINSICS = {
|
|
|
461
462
|
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
|
462
463
|
'%RegExp%': RegExp,
|
|
463
464
|
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
|
464
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
465
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
465
466
|
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
|
466
467
|
'%String%': String,
|
|
467
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
|
468
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
|
|
468
469
|
'%Symbol%': hasSymbols ? Symbol : undefined,
|
|
469
470
|
'%SyntaxError%': $SyntaxError,
|
|
470
471
|
'%ThrowTypeError%': ThrowTypeError,
|
|
@@ -479,11 +480,13 @@ var INTRINSICS = {
|
|
|
479
480
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
480
481
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
481
482
|
};
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
483
|
+
if (getProto) {
|
|
484
|
+
try {
|
|
485
|
+
null.error;
|
|
486
|
+
} catch (e) {
|
|
487
|
+
var errorProto = getProto(getProto(e));
|
|
488
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
489
|
+
}
|
|
487
490
|
}
|
|
488
491
|
var doEval = function doEval(name) {
|
|
489
492
|
var value;
|
|
@@ -500,7 +503,7 @@ var doEval = function doEval(name) {
|
|
|
500
503
|
}
|
|
501
504
|
} else if (name === '%AsyncIteratorPrototype%') {
|
|
502
505
|
var gen = doEval('%AsyncGenerator%');
|
|
503
|
-
if (gen) {
|
|
506
|
+
if (gen && getProto) {
|
|
504
507
|
value = getProto(gen.prototype);
|
|
505
508
|
}
|
|
506
509
|
}
|
|
@@ -668,7 +671,22 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
668
671
|
return value;
|
|
669
672
|
};
|
|
670
673
|
|
|
671
|
-
},{"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){
|
|
672
690
|
'use strict';
|
|
673
691
|
|
|
674
692
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
@@ -689,7 +707,7 @@ module.exports = function hasNativeSymbols() {
|
|
|
689
707
|
return hasSymbolSham();
|
|
690
708
|
};
|
|
691
709
|
|
|
692
|
-
},{"./shams":
|
|
710
|
+
},{"./shams":11}],11:[function(require,module,exports){
|
|
693
711
|
'use strict';
|
|
694
712
|
module.exports = function hasSymbols() {
|
|
695
713
|
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') {
|
|
@@ -737,13 +755,13 @@ module.exports = function hasSymbols() {
|
|
|
737
755
|
return true;
|
|
738
756
|
};
|
|
739
757
|
|
|
740
|
-
},{}],
|
|
758
|
+
},{}],12:[function(require,module,exports){
|
|
741
759
|
'use strict';
|
|
742
760
|
|
|
743
761
|
var bind = require('function-bind');
|
|
744
762
|
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
745
763
|
|
|
746
|
-
},{"function-bind":7}],
|
|
764
|
+
},{"function-bind":7}],13:[function(require,module,exports){
|
|
747
765
|
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
748
766
|
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
749
767
|
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
@@ -1243,7 +1261,7 @@ function arrObjKeys(obj, inspect) {
|
|
|
1243
1261
|
return xs;
|
|
1244
1262
|
}
|
|
1245
1263
|
|
|
1246
|
-
},{"./util.inspect":1}],
|
|
1264
|
+
},{"./util.inspect":1}],14:[function(require,module,exports){
|
|
1247
1265
|
var process = module.exports = {};
|
|
1248
1266
|
var cachedSetTimeout;
|
|
1249
1267
|
var cachedClearTimeout;
|
|
@@ -1400,7 +1418,7 @@ process.umask = function () {
|
|
|
1400
1418
|
return 0;
|
|
1401
1419
|
};
|
|
1402
1420
|
|
|
1403
|
-
},{}],
|
|
1421
|
+
},{}],15:[function(require,module,exports){
|
|
1404
1422
|
'use strict';
|
|
1405
1423
|
|
|
1406
1424
|
var replace = String.prototype.replace;
|
|
@@ -1423,7 +1441,7 @@ module.exports = {
|
|
|
1423
1441
|
RFC3986: Format.RFC3986
|
|
1424
1442
|
};
|
|
1425
1443
|
|
|
1426
|
-
},{}],
|
|
1444
|
+
},{}],16:[function(require,module,exports){
|
|
1427
1445
|
'use strict';
|
|
1428
1446
|
|
|
1429
1447
|
var stringify = require('./stringify');
|
|
@@ -1435,7 +1453,7 @@ module.exports = {
|
|
|
1435
1453
|
stringify: stringify
|
|
1436
1454
|
};
|
|
1437
1455
|
|
|
1438
|
-
},{"./formats":
|
|
1456
|
+
},{"./formats":15,"./parse":17,"./stringify":18}],17:[function(require,module,exports){
|
|
1439
1457
|
'use strict';
|
|
1440
1458
|
|
|
1441
1459
|
var utils = require('./utils');
|
|
@@ -1473,7 +1491,9 @@ var parseArrayValue = function (val, options) {
|
|
|
1473
1491
|
var isoSentinel = 'utf8=%26%2310003%3B';
|
|
1474
1492
|
var charsetSentinel = 'utf8=%E2%9C%93';
|
|
1475
1493
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
1476
|
-
var obj = {
|
|
1494
|
+
var obj = {
|
|
1495
|
+
__proto__: null
|
|
1496
|
+
};
|
|
1477
1497
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
1478
1498
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
1479
1499
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
@@ -1632,7 +1652,7 @@ module.exports = function (str, opts) {
|
|
|
1632
1652
|
return utils.compact(obj);
|
|
1633
1653
|
};
|
|
1634
1654
|
|
|
1635
|
-
},{"./utils":
|
|
1655
|
+
},{"./utils":19}],18:[function(require,module,exports){
|
|
1636
1656
|
'use strict';
|
|
1637
1657
|
|
|
1638
1658
|
var getSideChannel = require('side-channel');
|
|
@@ -1652,7 +1672,6 @@ var arrayPrefixGenerators = {
|
|
|
1652
1672
|
}
|
|
1653
1673
|
};
|
|
1654
1674
|
var isArray = Array.isArray;
|
|
1655
|
-
var split = String.prototype.split;
|
|
1656
1675
|
var push = Array.prototype.push;
|
|
1657
1676
|
var pushToArray = function (arr, valueOrArray) {
|
|
1658
1677
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
@@ -1721,14 +1740,6 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1721
1740
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
1722
1741
|
if (encoder) {
|
|
1723
1742
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
1724
|
-
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
|
1725
|
-
var valuesArray = split.call(String(obj), ',');
|
|
1726
|
-
var valuesJoined = '';
|
|
1727
|
-
for (var i = 0; i < valuesArray.length; ++i) {
|
|
1728
|
-
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
1729
|
-
}
|
|
1730
|
-
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
|
1731
|
-
}
|
|
1732
1743
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
1733
1744
|
}
|
|
1734
1745
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
@@ -1739,6 +1750,9 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1739
1750
|
}
|
|
1740
1751
|
var objKeys;
|
|
1741
1752
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
1753
|
+
if (encodeValuesOnly && encoder) {
|
|
1754
|
+
obj = utils.maybeMap(obj, encoder);
|
|
1755
|
+
}
|
|
1742
1756
|
objKeys = [{
|
|
1743
1757
|
value: obj.length > 0 ? obj.join(',') || null : void undefined
|
|
1744
1758
|
}];
|
|
@@ -1759,7 +1773,7 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRou
|
|
|
1759
1773
|
sideChannel.set(object, step);
|
|
1760
1774
|
var valueSideChannel = getSideChannel();
|
|
1761
1775
|
valueSideChannel.set(sentinel, sideChannel);
|
|
1762
|
-
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));
|
|
1763
1777
|
}
|
|
1764
1778
|
return values;
|
|
1765
1779
|
};
|
|
@@ -1859,7 +1873,7 @@ module.exports = function (object, opts) {
|
|
|
1859
1873
|
return joined.length > 0 ? prefix + joined : '';
|
|
1860
1874
|
};
|
|
1861
1875
|
|
|
1862
|
-
},{"./formats":
|
|
1876
|
+
},{"./formats":15,"./utils":19,"side-channel":20}],19:[function(require,module,exports){
|
|
1863
1877
|
'use strict';
|
|
1864
1878
|
|
|
1865
1879
|
var formats = require('./formats');
|
|
@@ -2063,7 +2077,7 @@ module.exports = {
|
|
|
2063
2077
|
merge: merge
|
|
2064
2078
|
};
|
|
2065
2079
|
|
|
2066
|
-
},{"./formats":
|
|
2080
|
+
},{"./formats":15}],20:[function(require,module,exports){
|
|
2067
2081
|
'use strict';
|
|
2068
2082
|
|
|
2069
2083
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -2173,7 +2187,7 @@ module.exports = function getSideChannel() {
|
|
|
2173
2187
|
return channel;
|
|
2174
2188
|
};
|
|
2175
2189
|
|
|
2176
|
-
},{"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){
|
|
2177
2191
|
function Agent() {
|
|
2178
2192
|
this._defaults = [];
|
|
2179
2193
|
}
|
|
@@ -2196,7 +2210,7 @@ Agent.prototype._setDefaults = function (request) {
|
|
|
2196
2210
|
};
|
|
2197
2211
|
module.exports = Agent;
|
|
2198
2212
|
|
|
2199
|
-
},{}],
|
|
2213
|
+
},{}],22:[function(require,module,exports){
|
|
2200
2214
|
let root;
|
|
2201
2215
|
if (typeof window !== 'undefined') {
|
|
2202
2216
|
root = window;
|
|
@@ -2236,7 +2250,7 @@ request.getXHR = () => {
|
|
|
2236
2250
|
}
|
|
2237
2251
|
throw new Error('Browser-only version of superagent could not find XHR');
|
|
2238
2252
|
};
|
|
2239
|
-
const trim = ''.trim ? s => s.trim() : s => s.
|
|
2253
|
+
const trim = ''.trim ? s => s.trim() : s => s.replaceAll(/(^\s*|\s*$)/g, '');
|
|
2240
2254
|
function serialize(object) {
|
|
2241
2255
|
if (!isObject(object)) return object;
|
|
2242
2256
|
const pairs = [];
|
|
@@ -2322,7 +2336,7 @@ function isJSON(mime) {
|
|
|
2322
2336
|
function Response(request_) {
|
|
2323
2337
|
this.req = request_;
|
|
2324
2338
|
this.xhr = this.req.xhr;
|
|
2325
|
-
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;
|
|
2326
2340
|
this.statusText = this.req.xhr.statusText;
|
|
2327
2341
|
let {
|
|
2328
2342
|
status
|
|
@@ -2387,7 +2401,7 @@ function Request(method, url) {
|
|
|
2387
2401
|
error.parse = true;
|
|
2388
2402
|
error.original = err;
|
|
2389
2403
|
if (self.xhr) {
|
|
2390
|
-
error.rawResponse =
|
|
2404
|
+
error.rawResponse = self.xhr.responseType === undefined ? self.xhr.responseText : self.xhr.response;
|
|
2391
2405
|
error.status = self.xhr.status ? self.xhr.status : null;
|
|
2392
2406
|
error.statusCode = error.status;
|
|
2393
2407
|
} else {
|
|
@@ -2592,7 +2606,7 @@ Request.prototype._end = function () {
|
|
|
2592
2606
|
xhr.responseType = this._responseType;
|
|
2593
2607
|
}
|
|
2594
2608
|
this.emit('request', this);
|
|
2595
|
-
xhr.send(
|
|
2609
|
+
xhr.send(data === undefined ? null : data);
|
|
2596
2610
|
};
|
|
2597
2611
|
request.agent = () => new Agent();
|
|
2598
2612
|
for (const method of ['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE']) {
|
|
@@ -2679,7 +2693,7 @@ request.put = (url, data, fn) => {
|
|
|
2679
2693
|
return request_;
|
|
2680
2694
|
};
|
|
2681
2695
|
|
|
2682
|
-
},{"./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){
|
|
2683
2697
|
(function (process){(function (){
|
|
2684
2698
|
const semver = require('semver');
|
|
2685
2699
|
const {
|
|
@@ -2720,16 +2734,24 @@ RequestBase.prototype.timeout = function (options) {
|
|
|
2720
2734
|
if (hasOwn(options, option)) {
|
|
2721
2735
|
switch (option) {
|
|
2722
2736
|
case 'deadline':
|
|
2723
|
-
|
|
2724
|
-
|
|
2737
|
+
{
|
|
2738
|
+
this._timeout = options.deadline;
|
|
2739
|
+
break;
|
|
2740
|
+
}
|
|
2725
2741
|
case 'response':
|
|
2726
|
-
|
|
2727
|
-
|
|
2742
|
+
{
|
|
2743
|
+
this._responseTimeout = options.response;
|
|
2744
|
+
break;
|
|
2745
|
+
}
|
|
2728
2746
|
case 'upload':
|
|
2729
|
-
|
|
2730
|
-
|
|
2747
|
+
{
|
|
2748
|
+
this._uploadTimeout = options.upload;
|
|
2749
|
+
break;
|
|
2750
|
+
}
|
|
2731
2751
|
default:
|
|
2732
|
-
|
|
2752
|
+
{
|
|
2753
|
+
console.warn('Unknown timeout option', option);
|
|
2754
|
+
}
|
|
2733
2755
|
}
|
|
2734
2756
|
}
|
|
2735
2757
|
}
|
|
@@ -2884,8 +2906,6 @@ RequestBase.prototype.abort = function () {
|
|
|
2884
2906
|
if (this.req) {
|
|
2885
2907
|
if (semver.gte(process.version, 'v13.0.0') && semver.lt(process.version, 'v14.0.0')) {
|
|
2886
2908
|
throw new Error('Superagent does not work in v13 properly with abort() due to Node.js core changes');
|
|
2887
|
-
} else if (semver.gte(process.version, 'v14.0.0')) {
|
|
2888
|
-
this.req.destroyed = true;
|
|
2889
2909
|
}
|
|
2890
2910
|
this.req.abort();
|
|
2891
2911
|
}
|
|
@@ -2896,17 +2916,25 @@ RequestBase.prototype.abort = function () {
|
|
|
2896
2916
|
RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
|
|
2897
2917
|
switch (options.type) {
|
|
2898
2918
|
case 'basic':
|
|
2899
|
-
|
|
2900
|
-
|
|
2919
|
+
{
|
|
2920
|
+
this.set('Authorization', `Basic ${base64Encoder(`${user}:${pass}`)}`);
|
|
2921
|
+
break;
|
|
2922
|
+
}
|
|
2901
2923
|
case 'auto':
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2924
|
+
{
|
|
2925
|
+
this.username = user;
|
|
2926
|
+
this.password = pass;
|
|
2927
|
+
break;
|
|
2928
|
+
}
|
|
2905
2929
|
case 'bearer':
|
|
2906
|
-
|
|
2907
|
-
|
|
2930
|
+
{
|
|
2931
|
+
this.set('Authorization', `Bearer ${user}`);
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2908
2934
|
default:
|
|
2909
|
-
|
|
2935
|
+
{
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2910
2938
|
}
|
|
2911
2939
|
return this;
|
|
2912
2940
|
};
|
|
@@ -2951,9 +2979,10 @@ RequestBase.prototype.send = function (data) {
|
|
|
2951
2979
|
}
|
|
2952
2980
|
if (isObject_ && isObject(this._data)) {
|
|
2953
2981
|
for (const key in data) {
|
|
2982
|
+
if (typeof data[key] === 'bigint') throw new Error('Cannot serialize BigInt value to json');
|
|
2954
2983
|
if (hasOwn(data, key)) this._data[key] = data[key];
|
|
2955
2984
|
}
|
|
2956
|
-
} 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') {
|
|
2957
2986
|
if (!type) this.type('form');
|
|
2958
2987
|
type = this._header['content-type'];
|
|
2959
2988
|
if (type) type = type.toLowerCase().trim();
|
|
@@ -2972,7 +3001,7 @@ RequestBase.prototype.send = function (data) {
|
|
|
2972
3001
|
return this;
|
|
2973
3002
|
};
|
|
2974
3003
|
RequestBase.prototype.sortQuery = function (sort) {
|
|
2975
|
-
this._sort =
|
|
3004
|
+
this._sort = sort === undefined ? true : sort;
|
|
2976
3005
|
return this;
|
|
2977
3006
|
};
|
|
2978
3007
|
RequestBase.prototype._finalizeQueryString = function () {
|
|
@@ -3025,7 +3054,7 @@ RequestBase.prototype._setTimeouts = function () {
|
|
|
3025
3054
|
};
|
|
3026
3055
|
|
|
3027
3056
|
}).call(this)}).call(this,require('_process'))
|
|
3028
|
-
},{"./utils":
|
|
3057
|
+
},{"./utils":25,"_process":14,"semver":1}],24:[function(require,module,exports){
|
|
3029
3058
|
const utils = require('./utils');
|
|
3030
3059
|
module.exports = ResponseBase;
|
|
3031
3060
|
function ResponseBase() {}
|
|
@@ -3068,7 +3097,7 @@ ResponseBase.prototype._setStatusProperties = function (status) {
|
|
|
3068
3097
|
this.unprocessableEntity = status === 422;
|
|
3069
3098
|
};
|
|
3070
3099
|
|
|
3071
|
-
},{"./utils":
|
|
3100
|
+
},{"./utils":25}],25:[function(require,module,exports){
|
|
3072
3101
|
exports.type = string_ => string_.split(/ *; */).shift();
|
|
3073
3102
|
exports.params = value => {
|
|
3074
3103
|
const object = {};
|
|
@@ -3118,5 +3147,5 @@ exports.mixin = (target, source) => {
|
|
|
3118
3147
|
}
|
|
3119
3148
|
};
|
|
3120
3149
|
|
|
3121
|
-
},{}]},{},[
|
|
3150
|
+
},{}]},{},[22])(22)
|
|
3122
3151
|
});
|