extra-request 3.0.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/es2015/index.min.mjs +2 -2
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +197 -30
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +199 -32
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +2 -2
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +2 -2
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +197 -30
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +199 -32
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +2 -2
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/transformers/form-data-field.js +2 -1
- package/lib/es2015/transformers/form-data-field.js.map +1 -1
- package/lib/es2018/transformers/form-data-field.js +2 -1
- package/lib/es2018/transformers/form-data-field.js.map +1 -1
- package/package.json +24 -25
package/dist/es2015/index.mjs
CHANGED
|
@@ -32,6 +32,11 @@ var abortController_browser = {};
|
|
|
32
32
|
abortController_browser.AbortController = void 0;
|
|
33
33
|
abortController_browser.AbortController = globalThis.AbortController;
|
|
34
34
|
|
|
35
|
+
var abortError_browser = {};
|
|
36
|
+
|
|
37
|
+
abortError_browser.AbortError = void 0;
|
|
38
|
+
abortError_browser.AbortError = globalThis.DOMException;
|
|
39
|
+
|
|
35
40
|
var blob_browser = {};
|
|
36
41
|
|
|
37
42
|
blob_browser.Blob = void 0;
|
|
@@ -58,6 +63,7 @@ __exportStar(request_browser, exports);
|
|
|
58
63
|
__exportStar(response_browser, exports);
|
|
59
64
|
__exportStar(formData_browser, exports);
|
|
60
65
|
__exportStar(abortController_browser, exports);
|
|
66
|
+
__exportStar(abortError_browser, exports);
|
|
61
67
|
__exportStar(blob_browser, exports);
|
|
62
68
|
__exportStar(eventSource_browser, exports);
|
|
63
69
|
|
|
@@ -115,8 +121,8 @@ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
|
|
|
115
121
|
const null_1$1 = _null;
|
|
116
122
|
const undefined_1$2 = _undefined;
|
|
117
123
|
function isAsyncIterable(val) {
|
|
118
|
-
return null_1$1.isntNull(val)
|
|
119
|
-
&& undefined_1$2.isntUndefined(val)
|
|
124
|
+
return (0, null_1$1.isntNull)(val)
|
|
125
|
+
&& (0, undefined_1$2.isntUndefined)(val)
|
|
120
126
|
&& typeof val[Symbol.asyncIterator] === 'function';
|
|
121
127
|
}
|
|
122
128
|
asyncIterable.isAsyncIterable = isAsyncIterable;
|
|
@@ -166,7 +172,7 @@ string.isntString = isntString;
|
|
|
166
172
|
char.isntChar = char.isChar = void 0;
|
|
167
173
|
const string_1$1 = string;
|
|
168
174
|
function isChar(val) {
|
|
169
|
-
return string_1$1.isString(val)
|
|
175
|
+
return (0, string_1$1.isString)(val)
|
|
170
176
|
&& val.length === 1;
|
|
171
177
|
}
|
|
172
178
|
char.isChar = isChar;
|
|
@@ -195,6 +201,18 @@ function inEnum(val, _enum) {
|
|
|
195
201
|
}
|
|
196
202
|
_enum.inEnum = inEnum;
|
|
197
203
|
|
|
204
|
+
var error = {};
|
|
205
|
+
|
|
206
|
+
error.isntError = error.isError = void 0;
|
|
207
|
+
function isError(val) {
|
|
208
|
+
return val instanceof Error;
|
|
209
|
+
}
|
|
210
|
+
error.isError = isError;
|
|
211
|
+
function isntError(val) {
|
|
212
|
+
return !isError(val);
|
|
213
|
+
}
|
|
214
|
+
error.isntError = isntError;
|
|
215
|
+
|
|
198
216
|
var falsy = {};
|
|
199
217
|
|
|
200
218
|
falsy.isntFalsy = falsy.isFalsy = void 0;
|
|
@@ -225,8 +243,8 @@ iterable.isntIterable = iterable.isIterable = void 0;
|
|
|
225
243
|
const null_1 = _null;
|
|
226
244
|
const undefined_1$1 = _undefined;
|
|
227
245
|
function isIterable(val) {
|
|
228
|
-
return null_1.isntNull(val)
|
|
229
|
-
&& undefined_1$1.isntUndefined(val)
|
|
246
|
+
return (0, null_1.isntNull)(val)
|
|
247
|
+
&& (0, undefined_1$1.isntUndefined)(val)
|
|
230
248
|
&& typeof val[Symbol.iterator] === 'function';
|
|
231
249
|
}
|
|
232
250
|
iterable.isIterable = isIterable;
|
|
@@ -239,19 +257,167 @@ var jsonRpc = {};
|
|
|
239
257
|
|
|
240
258
|
var object = {};
|
|
241
259
|
|
|
242
|
-
|
|
260
|
+
/**
|
|
261
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
262
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
263
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
264
|
+
* Released under MIT license <https://lodash.com/license>
|
|
265
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
266
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
/** `Object#toString` result references. */
|
|
270
|
+
var objectTag = '[object Object]';
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Checks if `value` is a host object in IE < 9.
|
|
274
|
+
*
|
|
275
|
+
* @private
|
|
276
|
+
* @param {*} value The value to check.
|
|
277
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
278
|
+
*/
|
|
279
|
+
function isHostObject(value) {
|
|
280
|
+
// Many host objects are `Object` objects that can coerce to strings
|
|
281
|
+
// despite having improperly defined `toString` methods.
|
|
282
|
+
var result = false;
|
|
283
|
+
if (value != null && typeof value.toString != 'function') {
|
|
284
|
+
try {
|
|
285
|
+
result = !!(value + '');
|
|
286
|
+
} catch (e) {}
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
293
|
+
*
|
|
294
|
+
* @private
|
|
295
|
+
* @param {Function} func The function to wrap.
|
|
296
|
+
* @param {Function} transform The argument transform.
|
|
297
|
+
* @returns {Function} Returns the new function.
|
|
298
|
+
*/
|
|
299
|
+
function overArg(func, transform) {
|
|
300
|
+
return function(arg) {
|
|
301
|
+
return func(transform(arg));
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Used for built-in method references. */
|
|
306
|
+
var funcProto = Function.prototype,
|
|
307
|
+
objectProto = Object.prototype;
|
|
308
|
+
|
|
309
|
+
/** Used to resolve the decompiled source of functions. */
|
|
310
|
+
var funcToString = funcProto.toString;
|
|
311
|
+
|
|
312
|
+
/** Used to check objects for own properties. */
|
|
313
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
314
|
+
|
|
315
|
+
/** Used to infer the `Object` constructor. */
|
|
316
|
+
var objectCtorString = funcToString.call(Object);
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Used to resolve the
|
|
320
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
321
|
+
* of values.
|
|
322
|
+
*/
|
|
323
|
+
var objectToString = objectProto.toString;
|
|
324
|
+
|
|
325
|
+
/** Built-in value references. */
|
|
326
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
330
|
+
* and has a `typeof` result of "object".
|
|
331
|
+
*
|
|
332
|
+
* @static
|
|
333
|
+
* @memberOf _
|
|
334
|
+
* @since 4.0.0
|
|
335
|
+
* @category Lang
|
|
336
|
+
* @param {*} value The value to check.
|
|
337
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
338
|
+
* @example
|
|
339
|
+
*
|
|
340
|
+
* _.isObjectLike({});
|
|
341
|
+
* // => true
|
|
342
|
+
*
|
|
343
|
+
* _.isObjectLike([1, 2, 3]);
|
|
344
|
+
* // => true
|
|
345
|
+
*
|
|
346
|
+
* _.isObjectLike(_.noop);
|
|
347
|
+
* // => false
|
|
348
|
+
*
|
|
349
|
+
* _.isObjectLike(null);
|
|
350
|
+
* // => false
|
|
351
|
+
*/
|
|
352
|
+
function isObjectLike(value) {
|
|
353
|
+
return !!value && typeof value == 'object';
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
358
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
359
|
+
*
|
|
360
|
+
* @static
|
|
361
|
+
* @memberOf _
|
|
362
|
+
* @since 0.8.0
|
|
363
|
+
* @category Lang
|
|
364
|
+
* @param {*} value The value to check.
|
|
365
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
366
|
+
* @example
|
|
367
|
+
*
|
|
368
|
+
* function Foo() {
|
|
369
|
+
* this.a = 1;
|
|
370
|
+
* }
|
|
371
|
+
*
|
|
372
|
+
* _.isPlainObject(new Foo);
|
|
373
|
+
* // => false
|
|
374
|
+
*
|
|
375
|
+
* _.isPlainObject([1, 2, 3]);
|
|
376
|
+
* // => false
|
|
377
|
+
*
|
|
378
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
379
|
+
* // => true
|
|
380
|
+
*
|
|
381
|
+
* _.isPlainObject(Object.create(null));
|
|
382
|
+
* // => true
|
|
383
|
+
*/
|
|
384
|
+
function isPlainObject$1(value) {
|
|
385
|
+
if (!isObjectLike(value) ||
|
|
386
|
+
objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
var proto = getPrototype(value);
|
|
390
|
+
if (proto === null) {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
394
|
+
return (typeof Ctor == 'function' &&
|
|
395
|
+
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
var lodash_isplainobject = isPlainObject$1;
|
|
399
|
+
|
|
400
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
401
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
402
|
+
};object.isntEmptyObject = object.isEmptyObject = object.isntPlainObject = object.isPlainObject = object.isntObject = object.isObject = void 0;
|
|
403
|
+
const lodash_isplainobject_1 = __importDefault(lodash_isplainobject);
|
|
243
404
|
function isObject(val) {
|
|
244
|
-
return val !== null
|
|
405
|
+
return val !== null
|
|
406
|
+
&& typeof val === 'object';
|
|
245
407
|
}
|
|
246
408
|
object.isObject = isObject;
|
|
247
409
|
function isntObject(val) {
|
|
248
410
|
return !isObject(val);
|
|
249
411
|
}
|
|
250
412
|
object.isntObject = isntObject;
|
|
251
|
-
function
|
|
252
|
-
return
|
|
413
|
+
function isPlainObject(val) {
|
|
414
|
+
return (0, lodash_isplainobject_1.default)(val);
|
|
415
|
+
}
|
|
416
|
+
object.isPlainObject = isPlainObject;
|
|
417
|
+
function isntPlainObject(val) {
|
|
418
|
+
return !isPlainObject(val);
|
|
253
419
|
}
|
|
254
|
-
object.
|
|
420
|
+
object.isntPlainObject = isntPlainObject;
|
|
255
421
|
function isEmptyObject(val) {
|
|
256
422
|
return Object.keys(val).length === 0;
|
|
257
423
|
}
|
|
@@ -280,16 +446,16 @@ const string_1 = string;
|
|
|
280
446
|
const number_1 = number;
|
|
281
447
|
const undefined_1 = _undefined;
|
|
282
448
|
function isJsonRpcId(val) {
|
|
283
|
-
return string_1.isString(val) || number_1.isNumber(val);
|
|
449
|
+
return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
|
|
284
450
|
}
|
|
285
451
|
function isJsonRpcParams(val) {
|
|
286
|
-
return array_1.isArray(val) || object_1.isObject(val);
|
|
452
|
+
return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
|
|
287
453
|
}
|
|
288
454
|
function isJsonRpcNotification(val) {
|
|
289
|
-
return object_1.
|
|
290
|
-
&& string_1.isString(val.jsonrpc)
|
|
291
|
-
&& string_1.isString(val.method)
|
|
292
|
-
&& undefined_1.isUndefined(val.id)
|
|
455
|
+
return (0, object_1.isPlainObject)(val)
|
|
456
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
457
|
+
&& (0, string_1.isString)(val.method)
|
|
458
|
+
&& (0, undefined_1.isUndefined)(val.id)
|
|
293
459
|
&& isJsonRpcParams(val.params);
|
|
294
460
|
}
|
|
295
461
|
jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
|
|
@@ -298,9 +464,9 @@ function isntJsonRpcNotification(val) {
|
|
|
298
464
|
}
|
|
299
465
|
jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
|
|
300
466
|
function isJsonRpcRequest(val) {
|
|
301
|
-
return object_1.
|
|
302
|
-
&& string_1.isString(val.jsonrpc)
|
|
303
|
-
&& string_1.isString(val.method)
|
|
467
|
+
return (0, object_1.isPlainObject)(val)
|
|
468
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
469
|
+
&& (0, string_1.isString)(val.method)
|
|
304
470
|
&& isJsonRpcId(val.id)
|
|
305
471
|
&& isJsonRpcParams(val.params);
|
|
306
472
|
}
|
|
@@ -310,10 +476,10 @@ function isntJsonRpcRequest(val) {
|
|
|
310
476
|
}
|
|
311
477
|
jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
|
|
312
478
|
function isJsonRpcSuccess(val) {
|
|
313
|
-
return object_1.
|
|
314
|
-
&& string_1.isString(val.jsonrpc)
|
|
315
|
-
&& string_1.isString(val.id)
|
|
316
|
-
&&
|
|
479
|
+
return (0, object_1.isPlainObject)(val)
|
|
480
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
481
|
+
&& (0, string_1.isString)(val.id)
|
|
482
|
+
&& 'result' in val;
|
|
317
483
|
}
|
|
318
484
|
jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
|
|
319
485
|
function isntJsonRpcSuccess(val) {
|
|
@@ -321,8 +487,8 @@ function isntJsonRpcSuccess(val) {
|
|
|
321
487
|
}
|
|
322
488
|
jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
|
|
323
489
|
function isJsonRpcError(val) {
|
|
324
|
-
return object_1.
|
|
325
|
-
&& string_1.isString(val.jsonrpc)
|
|
490
|
+
return (0, object_1.isPlainObject)(val)
|
|
491
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
326
492
|
&& isJsonRpcId(val.id)
|
|
327
493
|
&& isJsonRpcErrorObject(val.error);
|
|
328
494
|
}
|
|
@@ -332,10 +498,10 @@ function isntJsonRpcError(val) {
|
|
|
332
498
|
}
|
|
333
499
|
jsonRpc.isntJsonRpcError = isntJsonRpcError;
|
|
334
500
|
function isJsonRpcErrorObject(val) {
|
|
335
|
-
return object_1.
|
|
336
|
-
&& number_1.isNumber(val.code)
|
|
337
|
-
&& string_1.isString(val.message)
|
|
338
|
-
&& (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
|
|
501
|
+
return (0, object_1.isPlainObject)(val)
|
|
502
|
+
&& (0, number_1.isNumber)(val.code)
|
|
503
|
+
&& (0, string_1.isString)(val.message)
|
|
504
|
+
&& ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
|
|
339
505
|
}
|
|
340
506
|
|
|
341
507
|
var json$1 = {};
|
|
@@ -387,6 +553,7 @@ __exportStar(boolean, exports);
|
|
|
387
553
|
__exportStar(char, exports);
|
|
388
554
|
__exportStar(date, exports);
|
|
389
555
|
__exportStar(_enum, exports);
|
|
556
|
+
__exportStar(error, exports);
|
|
390
557
|
__exportStar(falsy, exports);
|
|
391
558
|
__exportStar(_function, exports);
|
|
392
559
|
__exportStar(iterable, exports);
|
|
@@ -669,7 +836,7 @@ function formDataField(name, value) {
|
|
|
669
836
|
const formData = options.payload instanceof es2018$2.FormData
|
|
670
837
|
? cloneFormData(options.payload)
|
|
671
838
|
: new es2018$2.FormData();
|
|
672
|
-
if (
|
|
839
|
+
if (es2018$1.isArray(value)) {
|
|
673
840
|
value.forEach(x => formData.append(name, x));
|
|
674
841
|
}
|
|
675
842
|
else {
|