superagent 5.2.2 → 6.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.
@@ -175,7 +175,7 @@ Emitter.prototype.hasListeners = function (event) {
175
175
  },{}],2:[function(require,module,exports){
176
176
  "use strict";
177
177
 
178
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
178
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
179
179
 
180
180
  module.exports = stringify;
181
181
  stringify.default = stringify;
@@ -371,15 +371,810 @@ function replaceGetterValues(replacer) {
371
371
  }
372
372
 
373
373
  },{}],3:[function(require,module,exports){
374
+ 'use strict';
375
+
376
+ var replace = String.prototype.replace;
377
+ var percentTwenties = /%20/g;
378
+
379
+ var util = require('./utils');
380
+
381
+ var Format = {
382
+ RFC1738: 'RFC1738',
383
+ RFC3986: 'RFC3986'
384
+ };
385
+ module.exports = util.assign({
386
+ 'default': Format.RFC3986,
387
+ formatters: {
388
+ RFC1738: function RFC1738(value) {
389
+ return replace.call(value, percentTwenties, '+');
390
+ },
391
+ RFC3986: function RFC3986(value) {
392
+ return String(value);
393
+ }
394
+ }
395
+ }, Format);
396
+
397
+ },{"./utils":7}],4:[function(require,module,exports){
398
+ 'use strict';
399
+
400
+ var stringify = require('./stringify');
401
+
402
+ var parse = require('./parse');
403
+
404
+ var formats = require('./formats');
405
+
406
+ module.exports = {
407
+ formats: formats,
408
+ parse: parse,
409
+ stringify: stringify
410
+ };
411
+
412
+ },{"./formats":3,"./parse":5,"./stringify":6}],5:[function(require,module,exports){
413
+ 'use strict';
414
+
415
+ var utils = require('./utils');
416
+
417
+ var has = Object.prototype.hasOwnProperty;
418
+ var isArray = Array.isArray;
419
+ var defaults = {
420
+ allowDots: false,
421
+ allowPrototypes: false,
422
+ arrayLimit: 20,
423
+ charset: 'utf-8',
424
+ charsetSentinel: false,
425
+ comma: false,
426
+ decoder: utils.decode,
427
+ delimiter: '&',
428
+ depth: 5,
429
+ ignoreQueryPrefix: false,
430
+ interpretNumericEntities: false,
431
+ parameterLimit: 1000,
432
+ parseArrays: true,
433
+ plainObjects: false,
434
+ strictNullHandling: false
435
+ };
436
+
437
+ var interpretNumericEntities = function interpretNumericEntities(str) {
438
+ return str.replace(/&#(\d+);/g, function ($0, numberStr) {
439
+ return String.fromCharCode(parseInt(numberStr, 10));
440
+ });
441
+ };
442
+
443
+ var parseArrayValue = function parseArrayValue(val, options) {
444
+ if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
445
+ return val.split(',');
446
+ }
447
+
448
+ return val;
449
+ }; // This is what browsers will submit when the ✓ character occurs in an
450
+ // application/x-www-form-urlencoded body and the encoding of the page containing
451
+ // the form is iso-8859-1, or when the submitted form has an accept-charset
452
+ // attribute of iso-8859-1. Presumably also with other charsets that do not contain
453
+ // the ✓ character, such as us-ascii.
454
+
455
+
456
+ var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
457
+ // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
458
+
459
+ var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
460
+
461
+ var parseValues = function parseQueryStringValues(str, options) {
462
+ var obj = {};
463
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
464
+ var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
465
+ var parts = cleanStr.split(options.delimiter, limit);
466
+ var skipIndex = -1; // Keep track of where the utf8 sentinel was found
467
+
468
+ var i;
469
+ var charset = options.charset;
470
+
471
+ if (options.charsetSentinel) {
472
+ for (i = 0; i < parts.length; ++i) {
473
+ if (parts[i].indexOf('utf8=') === 0) {
474
+ if (parts[i] === charsetSentinel) {
475
+ charset = 'utf-8';
476
+ } else if (parts[i] === isoSentinel) {
477
+ charset = 'iso-8859-1';
478
+ }
479
+
480
+ skipIndex = i;
481
+ i = parts.length; // The eslint settings do not allow break;
482
+ }
483
+ }
484
+ }
485
+
486
+ for (i = 0; i < parts.length; ++i) {
487
+ if (i === skipIndex) {
488
+ continue;
489
+ }
490
+
491
+ var part = parts[i];
492
+ var bracketEqualsPos = part.indexOf(']=');
493
+ var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
494
+ var key, val;
495
+
496
+ if (pos === -1) {
497
+ key = options.decoder(part, defaults.decoder, charset, 'key');
498
+ val = options.strictNullHandling ? null : '';
499
+ } else {
500
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
501
+ val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function (encodedVal) {
502
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
503
+ });
504
+ }
505
+
506
+ if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
507
+ val = interpretNumericEntities(val);
508
+ }
509
+
510
+ if (part.indexOf('[]=') > -1) {
511
+ val = isArray(val) ? [val] : val;
512
+ }
513
+
514
+ if (has.call(obj, key)) {
515
+ obj[key] = utils.combine(obj[key], val);
516
+ } else {
517
+ obj[key] = val;
518
+ }
519
+ }
520
+
521
+ return obj;
522
+ };
523
+
524
+ var parseObject = function parseObject(chain, val, options, valuesParsed) {
525
+ var leaf = valuesParsed ? val : parseArrayValue(val, options);
526
+
527
+ for (var i = chain.length - 1; i >= 0; --i) {
528
+ var obj;
529
+ var root = chain[i];
530
+
531
+ if (root === '[]' && options.parseArrays) {
532
+ obj = [].concat(leaf);
533
+ } else {
534
+ obj = options.plainObjects ? Object.create(null) : {};
535
+ var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
536
+ var index = parseInt(cleanRoot, 10);
537
+
538
+ if (!options.parseArrays && cleanRoot === '') {
539
+ obj = {
540
+ 0: leaf
541
+ };
542
+ } else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) {
543
+ obj = [];
544
+ obj[index] = leaf;
545
+ } else {
546
+ obj[cleanRoot] = leaf;
547
+ }
548
+ }
549
+
550
+ leaf = obj; // eslint-disable-line no-param-reassign
551
+ }
552
+
553
+ return leaf;
554
+ };
555
+
556
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
557
+ if (!givenKey) {
558
+ return;
559
+ } // Transform dot notation to bracket notation
560
+
561
+
562
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; // The regex chunks
563
+
564
+ var brackets = /(\[[^[\]]*])/;
565
+ var child = /(\[[^[\]]*])/g; // Get the parent
566
+
567
+ var segment = options.depth > 0 && brackets.exec(key);
568
+ var parent = segment ? key.slice(0, segment.index) : key; // Stash the parent if it exists
569
+
570
+ var keys = [];
571
+
572
+ if (parent) {
573
+ // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
574
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
575
+ if (!options.allowPrototypes) {
576
+ return;
577
+ }
578
+ }
579
+
580
+ keys.push(parent);
581
+ } // Loop through children appending to the array until we hit depth
582
+
583
+
584
+ var i = 0;
585
+
586
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
587
+ i += 1;
588
+
589
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
590
+ if (!options.allowPrototypes) {
591
+ return;
592
+ }
593
+ }
594
+
595
+ keys.push(segment[1]);
596
+ } // If there's a remainder, just add whatever is left
597
+
598
+
599
+ if (segment) {
600
+ keys.push('[' + key.slice(segment.index) + ']');
601
+ }
602
+
603
+ return parseObject(keys, val, options, valuesParsed);
604
+ };
605
+
606
+ var normalizeParseOptions = function normalizeParseOptions(opts) {
607
+ if (!opts) {
608
+ return defaults;
609
+ }
610
+
611
+ if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
612
+ throw new TypeError('Decoder has to be a function.');
613
+ }
614
+
615
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
616
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
617
+ }
618
+
619
+ var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
620
+ return {
621
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
622
+ allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
623
+ arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
624
+ charset: charset,
625
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
626
+ comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
627
+ decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
628
+ delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
629
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
630
+ depth: typeof opts.depth === 'number' || opts.depth === false ? +opts.depth : defaults.depth,
631
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
632
+ interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
633
+ parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
634
+ parseArrays: opts.parseArrays !== false,
635
+ plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
636
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
637
+ };
638
+ };
639
+
640
+ module.exports = function (str, opts) {
641
+ var options = normalizeParseOptions(opts);
642
+
643
+ if (str === '' || str === null || typeof str === 'undefined') {
644
+ return options.plainObjects ? Object.create(null) : {};
645
+ }
646
+
647
+ var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
648
+ var obj = options.plainObjects ? Object.create(null) : {}; // Iterate over the keys and setup the new object
649
+
650
+ var keys = Object.keys(tempObj);
651
+
652
+ for (var i = 0; i < keys.length; ++i) {
653
+ var key = keys[i];
654
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
655
+ obj = utils.merge(obj, newObj, options);
656
+ }
657
+
658
+ return utils.compact(obj);
659
+ };
660
+
661
+ },{"./utils":7}],6:[function(require,module,exports){
662
+ 'use strict';
663
+
664
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
665
+
666
+ var utils = require('./utils');
667
+
668
+ var formats = require('./formats');
669
+
670
+ var has = Object.prototype.hasOwnProperty;
671
+ var arrayPrefixGenerators = {
672
+ brackets: function brackets(prefix) {
673
+ return prefix + '[]';
674
+ },
675
+ comma: 'comma',
676
+ indices: function indices(prefix, key) {
677
+ return prefix + '[' + key + ']';
678
+ },
679
+ repeat: function repeat(prefix) {
680
+ return prefix;
681
+ }
682
+ };
683
+ var isArray = Array.isArray;
684
+ var push = Array.prototype.push;
685
+
686
+ var pushToArray = function pushToArray(arr, valueOrArray) {
687
+ push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
688
+ };
689
+
690
+ var toISO = Date.prototype.toISOString;
691
+ var defaultFormat = formats['default'];
692
+ var defaults = {
693
+ addQueryPrefix: false,
694
+ allowDots: false,
695
+ charset: 'utf-8',
696
+ charsetSentinel: false,
697
+ delimiter: '&',
698
+ encode: true,
699
+ encoder: utils.encode,
700
+ encodeValuesOnly: false,
701
+ format: defaultFormat,
702
+ formatter: formats.formatters[defaultFormat],
703
+ // deprecated
704
+ indices: false,
705
+ serializeDate: function serializeDate(date) {
706
+ return toISO.call(date);
707
+ },
708
+ skipNulls: false,
709
+ strictNullHandling: false
710
+ };
711
+
712
+ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
713
+ return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || _typeof(v) === 'symbol' || typeof v === 'bigint';
714
+ };
715
+
716
+ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset) {
717
+ var obj = object;
718
+
719
+ if (typeof filter === 'function') {
720
+ obj = filter(prefix, obj);
721
+ } else if (obj instanceof Date) {
722
+ obj = serializeDate(obj);
723
+ } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
724
+ obj = utils.maybeMap(obj, function (value) {
725
+ if (value instanceof Date) {
726
+ return serializeDate(value);
727
+ }
728
+
729
+ return value;
730
+ }).join(',');
731
+ }
732
+
733
+ if (obj === null) {
734
+ if (strictNullHandling) {
735
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix;
736
+ }
737
+
738
+ obj = '';
739
+ }
740
+
741
+ if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
742
+ if (encoder) {
743
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key');
744
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))];
745
+ }
746
+
747
+ return [formatter(prefix) + '=' + formatter(String(obj))];
748
+ }
749
+
750
+ var values = [];
751
+
752
+ if (typeof obj === 'undefined') {
753
+ return values;
754
+ }
755
+
756
+ var objKeys;
757
+
758
+ if (isArray(filter)) {
759
+ objKeys = filter;
760
+ } else {
761
+ var keys = Object.keys(obj);
762
+ objKeys = sort ? keys.sort(sort) : keys;
763
+ }
764
+
765
+ for (var i = 0; i < objKeys.length; ++i) {
766
+ var key = objKeys[i];
767
+ var value = obj[key];
768
+
769
+ if (skipNulls && value === null) {
770
+ continue;
771
+ }
772
+
773
+ var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? '.' + key : '[' + key + ']');
774
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset));
775
+ }
776
+
777
+ return values;
778
+ };
779
+
780
+ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
781
+ if (!opts) {
782
+ return defaults;
783
+ }
784
+
785
+ if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
786
+ throw new TypeError('Encoder has to be a function.');
787
+ }
788
+
789
+ var charset = opts.charset || defaults.charset;
790
+
791
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
792
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
793
+ }
794
+
795
+ var format = formats['default'];
796
+
797
+ if (typeof opts.format !== 'undefined') {
798
+ if (!has.call(formats.formatters, opts.format)) {
799
+ throw new TypeError('Unknown format option provided.');
800
+ }
801
+
802
+ format = opts.format;
803
+ }
804
+
805
+ var formatter = formats.formatters[format];
806
+ var filter = defaults.filter;
807
+
808
+ if (typeof opts.filter === 'function' || isArray(opts.filter)) {
809
+ filter = opts.filter;
810
+ }
811
+
812
+ return {
813
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
814
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
815
+ charset: charset,
816
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
817
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
818
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
819
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
820
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
821
+ filter: filter,
822
+ formatter: formatter,
823
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
824
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
825
+ sort: typeof opts.sort === 'function' ? opts.sort : null,
826
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
827
+ };
828
+ };
829
+
830
+ module.exports = function (object, opts) {
831
+ var obj = object;
832
+ var options = normalizeStringifyOptions(opts);
833
+ var objKeys;
834
+ var filter;
835
+
836
+ if (typeof options.filter === 'function') {
837
+ filter = options.filter;
838
+ obj = filter('', obj);
839
+ } else if (isArray(options.filter)) {
840
+ filter = options.filter;
841
+ objKeys = filter;
842
+ }
843
+
844
+ var keys = [];
845
+
846
+ if (_typeof(obj) !== 'object' || obj === null) {
847
+ return '';
848
+ }
849
+
850
+ var arrayFormat;
851
+
852
+ if (opts && opts.arrayFormat in arrayPrefixGenerators) {
853
+ arrayFormat = opts.arrayFormat;
854
+ } else if (opts && 'indices' in opts) {
855
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
856
+ } else {
857
+ arrayFormat = 'indices';
858
+ }
859
+
860
+ var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
861
+
862
+ if (!objKeys) {
863
+ objKeys = Object.keys(obj);
864
+ }
865
+
866
+ if (options.sort) {
867
+ objKeys.sort(options.sort);
868
+ }
869
+
870
+ for (var i = 0; i < objKeys.length; ++i) {
871
+ var key = objKeys[i];
872
+
873
+ if (options.skipNulls && obj[key] === null) {
874
+ continue;
875
+ }
876
+
877
+ pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.formatter, options.encodeValuesOnly, options.charset));
878
+ }
879
+
880
+ var joined = keys.join(options.delimiter);
881
+ var prefix = options.addQueryPrefix === true ? '?' : '';
882
+
883
+ if (options.charsetSentinel) {
884
+ if (options.charset === 'iso-8859-1') {
885
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
886
+ prefix += 'utf8=%26%2310003%3B&';
887
+ } else {
888
+ // encodeURIComponent('✓')
889
+ prefix += 'utf8=%E2%9C%93&';
890
+ }
891
+ }
892
+
893
+ return joined.length > 0 ? prefix + joined : '';
894
+ };
895
+
896
+ },{"./formats":3,"./utils":7}],7:[function(require,module,exports){
897
+ 'use strict';
898
+
899
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
900
+
901
+ var has = Object.prototype.hasOwnProperty;
902
+ var isArray = Array.isArray;
903
+
904
+ var hexTable = function () {
905
+ var array = [];
906
+
907
+ for (var i = 0; i < 256; ++i) {
908
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
909
+ }
910
+
911
+ return array;
912
+ }();
913
+
914
+ var compactQueue = function compactQueue(queue) {
915
+ while (queue.length > 1) {
916
+ var item = queue.pop();
917
+ var obj = item.obj[item.prop];
918
+
919
+ if (isArray(obj)) {
920
+ var compacted = [];
921
+
922
+ for (var j = 0; j < obj.length; ++j) {
923
+ if (typeof obj[j] !== 'undefined') {
924
+ compacted.push(obj[j]);
925
+ }
926
+ }
927
+
928
+ item.obj[item.prop] = compacted;
929
+ }
930
+ }
931
+ };
932
+
933
+ var arrayToObject = function arrayToObject(source, options) {
934
+ var obj = options && options.plainObjects ? Object.create(null) : {};
935
+
936
+ for (var i = 0; i < source.length; ++i) {
937
+ if (typeof source[i] !== 'undefined') {
938
+ obj[i] = source[i];
939
+ }
940
+ }
941
+
942
+ return obj;
943
+ };
944
+
945
+ var merge = function merge(target, source, options) {
946
+ /* eslint no-param-reassign: 0 */
947
+ if (!source) {
948
+ return target;
949
+ }
950
+
951
+ if (_typeof(source) !== 'object') {
952
+ if (isArray(target)) {
953
+ target.push(source);
954
+ } else if (target && _typeof(target) === 'object') {
955
+ if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
956
+ target[source] = true;
957
+ }
958
+ } else {
959
+ return [target, source];
960
+ }
961
+
962
+ return target;
963
+ }
964
+
965
+ if (!target || _typeof(target) !== 'object') {
966
+ return [target].concat(source);
967
+ }
968
+
969
+ var mergeTarget = target;
970
+
971
+ if (isArray(target) && !isArray(source)) {
972
+ mergeTarget = arrayToObject(target, options);
973
+ }
974
+
975
+ if (isArray(target) && isArray(source)) {
976
+ source.forEach(function (item, i) {
977
+ if (has.call(target, i)) {
978
+ var targetItem = target[i];
979
+
980
+ if (targetItem && _typeof(targetItem) === 'object' && item && _typeof(item) === 'object') {
981
+ target[i] = merge(targetItem, item, options);
982
+ } else {
983
+ target.push(item);
984
+ }
985
+ } else {
986
+ target[i] = item;
987
+ }
988
+ });
989
+ return target;
990
+ }
991
+
992
+ return Object.keys(source).reduce(function (acc, key) {
993
+ var value = source[key];
994
+
995
+ if (has.call(acc, key)) {
996
+ acc[key] = merge(acc[key], value, options);
997
+ } else {
998
+ acc[key] = value;
999
+ }
1000
+
1001
+ return acc;
1002
+ }, mergeTarget);
1003
+ };
1004
+
1005
+ var assign = function assignSingleSource(target, source) {
1006
+ return Object.keys(source).reduce(function (acc, key) {
1007
+ acc[key] = source[key];
1008
+ return acc;
1009
+ }, target);
1010
+ };
1011
+
1012
+ var decode = function decode(str, decoder, charset) {
1013
+ var strWithoutPlus = str.replace(/\+/g, ' ');
1014
+
1015
+ if (charset === 'iso-8859-1') {
1016
+ // unescape never throws, no try...catch needed:
1017
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1018
+ } // utf-8
1019
+
1020
+
1021
+ try {
1022
+ return decodeURIComponent(strWithoutPlus);
1023
+ } catch (e) {
1024
+ return strWithoutPlus;
1025
+ }
1026
+ };
1027
+
1028
+ var encode = function encode(str, defaultEncoder, charset) {
1029
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1030
+ // It has been adapted here for stricter adherence to RFC 3986
1031
+ if (str.length === 0) {
1032
+ return str;
1033
+ }
1034
+
1035
+ var string = str;
1036
+
1037
+ if (_typeof(str) === 'symbol') {
1038
+ string = Symbol.prototype.toString.call(str);
1039
+ } else if (typeof str !== 'string') {
1040
+ string = String(str);
1041
+ }
1042
+
1043
+ if (charset === 'iso-8859-1') {
1044
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1045
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1046
+ });
1047
+ }
1048
+
1049
+ var out = '';
1050
+
1051
+ for (var i = 0; i < string.length; ++i) {
1052
+ var c = string.charCodeAt(i);
1053
+
1054
+ if (c === 0x2D // -
1055
+ || c === 0x2E // .
1056
+ || c === 0x5F // _
1057
+ || c === 0x7E // ~
1058
+ || c >= 0x30 && c <= 0x39 // 0-9
1059
+ || c >= 0x41 && c <= 0x5A // a-z
1060
+ || c >= 0x61 && c <= 0x7A // A-Z
1061
+ ) {
1062
+ out += string.charAt(i);
1063
+ continue;
1064
+ }
1065
+
1066
+ if (c < 0x80) {
1067
+ out = out + hexTable[c];
1068
+ continue;
1069
+ }
1070
+
1071
+ if (c < 0x800) {
1072
+ out = out + (hexTable[0xC0 | c >> 6] + hexTable[0x80 | c & 0x3F]);
1073
+ continue;
1074
+ }
1075
+
1076
+ if (c < 0xD800 || c >= 0xE000) {
1077
+ out = out + (hexTable[0xE0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F]);
1078
+ continue;
1079
+ }
1080
+
1081
+ i += 1;
1082
+ c = 0x10000 + ((c & 0x3FF) << 10 | string.charCodeAt(i) & 0x3FF);
1083
+ out += hexTable[0xF0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3F] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | c & 0x3F];
1084
+ }
1085
+
1086
+ return out;
1087
+ };
1088
+
1089
+ var compact = function compact(value) {
1090
+ var queue = [{
1091
+ obj: {
1092
+ o: value
1093
+ },
1094
+ prop: 'o'
1095
+ }];
1096
+ var refs = [];
1097
+
1098
+ for (var i = 0; i < queue.length; ++i) {
1099
+ var item = queue[i];
1100
+ var obj = item.obj[item.prop];
1101
+ var keys = Object.keys(obj);
1102
+
1103
+ for (var j = 0; j < keys.length; ++j) {
1104
+ var key = keys[j];
1105
+ var val = obj[key];
1106
+
1107
+ if (_typeof(val) === 'object' && val !== null && refs.indexOf(val) === -1) {
1108
+ queue.push({
1109
+ obj: obj,
1110
+ prop: key
1111
+ });
1112
+ refs.push(val);
1113
+ }
1114
+ }
1115
+ }
1116
+
1117
+ compactQueue(queue);
1118
+ return value;
1119
+ };
1120
+
1121
+ var isRegExp = function isRegExp(obj) {
1122
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
1123
+ };
1124
+
1125
+ var isBuffer = function isBuffer(obj) {
1126
+ if (!obj || _typeof(obj) !== 'object') {
1127
+ return false;
1128
+ }
1129
+
1130
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1131
+ };
1132
+
1133
+ var combine = function combine(a, b) {
1134
+ return [].concat(a, b);
1135
+ };
1136
+
1137
+ var maybeMap = function maybeMap(val, fn) {
1138
+ if (isArray(val)) {
1139
+ var mapped = [];
1140
+
1141
+ for (var i = 0; i < val.length; i += 1) {
1142
+ mapped.push(fn(val[i]));
1143
+ }
1144
+
1145
+ return mapped;
1146
+ }
1147
+
1148
+ return fn(val);
1149
+ };
1150
+
1151
+ module.exports = {
1152
+ arrayToObject: arrayToObject,
1153
+ assign: assign,
1154
+ combine: combine,
1155
+ compact: compact,
1156
+ decode: decode,
1157
+ encode: encode,
1158
+ isBuffer: isBuffer,
1159
+ isRegExp: isRegExp,
1160
+ maybeMap: maybeMap,
1161
+ merge: merge
1162
+ };
1163
+
1164
+ },{}],8:[function(require,module,exports){
374
1165
  "use strict";
375
1166
 
376
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
1167
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
377
1168
 
378
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
1169
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
379
1170
 
380
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
1171
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
381
1172
 
382
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
1173
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1174
+
1175
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1176
+
1177
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
383
1178
 
384
1179
  function Agent() {
385
1180
  this._defaults = [];
@@ -409,10 +1204,10 @@ Agent.prototype._setDefaults = function (req) {
409
1204
 
410
1205
  module.exports = Agent;
411
1206
 
412
- },{}],4:[function(require,module,exports){
1207
+ },{}],9:[function(require,module,exports){
413
1208
  "use strict";
414
1209
 
415
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1210
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
416
1211
 
417
1212
  /**
418
1213
  * Check if `obj` is an object.
@@ -427,10 +1222,10 @@ function isObject(obj) {
427
1222
 
428
1223
  module.exports = isObject;
429
1224
 
430
- },{}],5:[function(require,module,exports){
1225
+ },{}],10:[function(require,module,exports){
431
1226
  "use strict";
432
1227
 
433
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1228
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
434
1229
 
435
1230
  /**
436
1231
  * Root reference for iframes.
@@ -453,6 +1248,8 @@ var Emitter = require('component-emitter');
453
1248
 
454
1249
  var safeStringify = require('fast-safe-stringify');
455
1250
 
1251
+ var qs = require('qs');
1252
+
456
1253
  var RequestBase = require('./request-base');
457
1254
 
458
1255
  var isObject = require('./is-object');
@@ -641,7 +1438,7 @@ request.types = {
641
1438
  */
642
1439
 
643
1440
  request.serialize = {
644
- 'application/x-www-form-urlencoded': serialize,
1441
+ 'application/x-www-form-urlencoded': qs.stringify,
645
1442
  'application/json': safeStringify
646
1443
  };
647
1444
  /**
@@ -702,7 +1499,7 @@ function parseHeader(str) {
702
1499
  function isJSON(mime) {
703
1500
  // should match /json or +json
704
1501
  // but not /json-seq
705
- return /[/+]json($|[^-\w])/.test(mime);
1502
+ return /[/+]json($|[^-\w])/i.test(mime);
706
1503
  }
707
1504
  /**
708
1505
  * Initialize a new `Response` with the given `xhr`.
@@ -1448,10 +2245,10 @@ request.put = function (url, data, fn) {
1448
2245
  return req;
1449
2246
  };
1450
2247
 
1451
- },{"./agent-base":3,"./is-object":4,"./request-base":6,"./response-base":7,"component-emitter":1,"fast-safe-stringify":2}],6:[function(require,module,exports){
2248
+ },{"./agent-base":8,"./is-object":9,"./request-base":11,"./response-base":12,"component-emitter":1,"fast-safe-stringify":2,"qs":4}],11:[function(require,module,exports){
1452
2249
  "use strict";
1453
2250
 
1454
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2251
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1455
2252
 
1456
2253
  /**
1457
2254
  * Module of mixed-in functions shared between node and client code
@@ -1469,8 +2266,8 @@ module.exports = RequestBase;
1469
2266
  * @api public
1470
2267
  */
1471
2268
 
1472
- function RequestBase(obj) {
1473
- if (obj) return mixin(obj);
2269
+ function RequestBase(object) {
2270
+ if (object) return mixin(object);
1474
2271
  }
1475
2272
  /**
1476
2273
  * Mixin the prototype properties.
@@ -1481,12 +2278,12 @@ function RequestBase(obj) {
1481
2278
  */
1482
2279
 
1483
2280
 
1484
- function mixin(obj) {
2281
+ function mixin(object) {
1485
2282
  for (var key in RequestBase.prototype) {
1486
- if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
2283
+ if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) object[key] = RequestBase.prototype[key];
1487
2284
  }
1488
2285
 
1489
- return obj;
2286
+ return object;
1490
2287
  }
1491
2288
  /**
1492
2289
  * Clear previous timeout.
@@ -1538,8 +2335,8 @@ RequestBase.prototype.parse = function (fn) {
1538
2335
  */
1539
2336
 
1540
2337
 
1541
- RequestBase.prototype.responseType = function (val) {
1542
- this._responseType = val;
2338
+ RequestBase.prototype.responseType = function (value) {
2339
+ this._responseType = value;
1543
2340
  return this;
1544
2341
  };
1545
2342
  /**
@@ -1622,12 +2419,26 @@ RequestBase.prototype.retry = function (count, fn) {
1622
2419
  this._retries = 0;
1623
2420
  this._retryCallback = fn;
1624
2421
  return this;
1625
- };
2422
+ }; //
2423
+ // NOTE: we do not include ESOCKETTIMEDOUT because that is from `request` package
2424
+ // <https://github.com/sindresorhus/got/pull/537>
2425
+ //
2426
+ // NOTE: we do not include EADDRINFO because it was removed from libuv in 2014
2427
+ // <https://github.com/libuv/libuv/commit/02e1ebd40b807be5af46343ea873331b2ee4e9c1>
2428
+ // <https://github.com/request/request/search?q=ESOCKETTIMEDOUT&unscoped_q=ESOCKETTIMEDOUT>
2429
+ //
2430
+ //
2431
+ // TODO: expose these as configurable defaults
2432
+ //
2433
+
2434
+
2435
+ var ERROR_CODES = new Set(['ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN']);
2436
+ var STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]); // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
2437
+ // const METHODS = new Set(['GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE']);
1626
2438
 
1627
- var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
1628
2439
  /**
1629
2440
  * Determine if a request should be retried.
1630
- * (Borrowed from segmentio/superagent-retry)
2441
+ * (Inspired by https://github.com/sindresorhus/got#retry)
1631
2442
  *
1632
2443
  * @param {Error} err an error
1633
2444
  * @param {Response} [res] response
@@ -1648,12 +2459,22 @@ RequestBase.prototype._shouldRetry = function (err, res) {
1648
2459
  } catch (err_) {
1649
2460
  console.error(err_);
1650
2461
  }
1651
- }
2462
+ } // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
2463
+
2464
+ /*
2465
+ if (
2466
+ this.req &&
2467
+ this.req.method &&
2468
+ !METHODS.has(this.req.method.toUpperCase())
2469
+ )
2470
+ return false;
2471
+ */
1652
2472
 
1653
- if (res && res.status && res.status >= 500 && res.status !== 501) return true;
2473
+
2474
+ if (res && res.status && STATUS_CODES.has(res.status)) return true;
1654
2475
 
1655
2476
  if (err) {
1656
- if (err.code && ERROR_CODES.includes(err.code)) return true; // Superagent timeout
2477
+ if (err.code && ERROR_CODES.has(err.code)) return true; // Superagent timeout
1657
2478
 
1658
2479
  if (err.timeout && err.code === 'ECONNABORTED') return true;
1659
2480
  if (err.crossDomain) return true;
@@ -1703,6 +2524,10 @@ RequestBase.prototype.then = function (resolve, reject) {
1703
2524
 
1704
2525
  this._fullfilledPromise = new Promise(function (resolve, reject) {
1705
2526
  self.on('abort', function () {
2527
+ if (_this._maxRetries && _this._maxRetries > _this._retries) {
2528
+ return;
2529
+ }
2530
+
1706
2531
  if (_this.timedout && _this.timedoutError) {
1707
2532
  reject(_this.timedoutError);
1708
2533
  return;
@@ -1802,7 +2627,7 @@ RequestBase.prototype.getHeader = RequestBase.prototype.get;
1802
2627
  * @api public
1803
2628
  */
1804
2629
 
1805
- RequestBase.prototype.set = function (field, val) {
2630
+ RequestBase.prototype.set = function (field, value) {
1806
2631
  if (isObject(field)) {
1807
2632
  for (var key in field) {
1808
2633
  if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
@@ -1811,8 +2636,8 @@ RequestBase.prototype.set = function (field, val) {
1811
2636
  return this;
1812
2637
  }
1813
2638
 
1814
- this._header[field.toLowerCase()] = val;
1815
- this.header[field] = val;
2639
+ this._header[field.toLowerCase()] = value;
2640
+ this.header[field] = value;
1816
2641
  return this;
1817
2642
  };
1818
2643
  /**
@@ -1855,7 +2680,7 @@ RequestBase.prototype.unset = function (field) {
1855
2680
  */
1856
2681
 
1857
2682
 
1858
- RequestBase.prototype.field = function (name, val) {
2683
+ RequestBase.prototype.field = function (name, value) {
1859
2684
  // name should be either a string or an object.
1860
2685
  if (name === null || undefined === name) {
1861
2686
  throw new Error('.field(name, val) name can not be empty');
@@ -1873,24 +2698,24 @@ RequestBase.prototype.field = function (name, val) {
1873
2698
  return this;
1874
2699
  }
1875
2700
 
1876
- if (Array.isArray(val)) {
1877
- for (var i in val) {
1878
- if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
2701
+ if (Array.isArray(value)) {
2702
+ for (var i in value) {
2703
+ if (Object.prototype.hasOwnProperty.call(value, i)) this.field(name, value[i]);
1879
2704
  }
1880
2705
 
1881
2706
  return this;
1882
2707
  } // val should be defined now
1883
2708
 
1884
2709
 
1885
- if (val === null || undefined === val) {
2710
+ if (value === null || undefined === value) {
1886
2711
  throw new Error('.field(name, val) val can not be empty');
1887
2712
  }
1888
2713
 
1889
- if (typeof val === 'boolean') {
1890
- val = String(val);
2714
+ if (typeof value === 'boolean') {
2715
+ value = String(value);
1891
2716
  }
1892
2717
 
1893
- this._getFormData().append(name, val);
2718
+ this._getFormData().append(name, value);
1894
2719
 
1895
2720
  return this;
1896
2721
  };
@@ -2048,14 +2873,14 @@ RequestBase.prototype.toJSON = function () {
2048
2873
 
2049
2874
 
2050
2875
  RequestBase.prototype.send = function (data) {
2051
- var isObj = isObject(data);
2876
+ var isObject_ = isObject(data);
2052
2877
  var type = this._header['content-type'];
2053
2878
 
2054
2879
  if (this._formData) {
2055
2880
  throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
2056
2881
  }
2057
2882
 
2058
- if (isObj && !this._data) {
2883
+ if (isObject_ && !this._data) {
2059
2884
  if (Array.isArray(data)) {
2060
2885
  this._data = [];
2061
2886
  } else if (!this._isHost(data)) {
@@ -2066,7 +2891,7 @@ RequestBase.prototype.send = function (data) {
2066
2891
  } // merge
2067
2892
 
2068
2893
 
2069
- if (isObj && isObject(this._data)) {
2894
+ if (isObject_ && isObject(this._data)) {
2070
2895
  for (var key in data) {
2071
2896
  if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
2072
2897
  }
@@ -2074,6 +2899,7 @@ RequestBase.prototype.send = function (data) {
2074
2899
  // default to x-www-form-urlencoded
2075
2900
  if (!type) this.type('form');
2076
2901
  type = this._header['content-type'];
2902
+ if (type) type = type.toLowerCase().trim();
2077
2903
 
2078
2904
  if (type === 'application/x-www-form-urlencoded') {
2079
2905
  this._data = this._data ? "".concat(this._data, "&").concat(data) : data;
@@ -2084,7 +2910,7 @@ RequestBase.prototype.send = function (data) {
2084
2910
  this._data = data;
2085
2911
  }
2086
2912
 
2087
- if (!isObj || this._isHost(data)) {
2913
+ if (!isObject_ || this._isHost(data)) {
2088
2914
  return this;
2089
2915
  } // default to json
2090
2916
 
@@ -2146,15 +2972,15 @@ RequestBase.prototype._finalizeQueryString = function () {
2146
2972
  var index = this.url.indexOf('?');
2147
2973
 
2148
2974
  if (index >= 0) {
2149
- var queryArr = this.url.slice(index + 1).split('&');
2975
+ var queryArray = this.url.slice(index + 1).split('&');
2150
2976
 
2151
2977
  if (typeof this._sort === 'function') {
2152
- queryArr.sort(this._sort);
2978
+ queryArray.sort(this._sort);
2153
2979
  } else {
2154
- queryArr.sort();
2980
+ queryArray.sort();
2155
2981
  }
2156
2982
 
2157
- this.url = this.url.slice(0, index) + '?' + queryArr.join('&');
2983
+ this.url = this.url.slice(0, index) + '?' + queryArray.join('&');
2158
2984
  }
2159
2985
  }
2160
2986
  }; // For backwards compat only
@@ -2202,7 +3028,7 @@ RequestBase.prototype._setTimeouts = function () {
2202
3028
  }
2203
3029
  };
2204
3030
 
2205
- },{"./is-object":4}],7:[function(require,module,exports){
3031
+ },{"./is-object":9}],12:[function(require,module,exports){
2206
3032
  "use strict";
2207
3033
 
2208
3034
  /**
@@ -2334,9 +3160,15 @@ ResponseBase.prototype._setStatusProperties = function (status) {
2334
3160
  this.unprocessableEntity = status === 422;
2335
3161
  };
2336
3162
 
2337
- },{"./utils":8}],8:[function(require,module,exports){
3163
+ },{"./utils":13}],13:[function(require,module,exports){
2338
3164
  "use strict";
2339
3165
 
3166
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3167
+
3168
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3169
+
3170
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3171
+
2340
3172
  /**
2341
3173
  * Return the mime type for the given `str`.
2342
3174
  *
@@ -2356,14 +3188,29 @@ exports.type = function (str) {
2356
3188
  */
2357
3189
 
2358
3190
 
2359
- exports.params = function (str) {
2360
- return str.split(/ *; */).reduce(function (obj, str) {
2361
- var parts = str.split(/ *= */);
2362
- var key = parts.shift();
2363
- var val = parts.shift();
2364
- if (key && val) obj[key] = val;
2365
- return obj;
2366
- }, {});
3191
+ exports.params = function (val) {
3192
+ var obj = {};
3193
+
3194
+ var _iterator = _createForOfIteratorHelper(val.split(/ *; */)),
3195
+ _step;
3196
+
3197
+ try {
3198
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3199
+ var str = _step.value;
3200
+ var parts = str.split(/ *= */);
3201
+ var key = parts.shift();
3202
+
3203
+ var _val = parts.shift();
3204
+
3205
+ if (key && _val) obj[key] = _val;
3206
+ }
3207
+ } catch (err) {
3208
+ _iterator.e(err);
3209
+ } finally {
3210
+ _iterator.f();
3211
+ }
3212
+
3213
+ return obj;
2367
3214
  };
2368
3215
  /**
2369
3216
  * Parse Link header fields.
@@ -2374,14 +3221,27 @@ exports.params = function (str) {
2374
3221
  */
2375
3222
 
2376
3223
 
2377
- exports.parseLinks = function (str) {
2378
- return str.split(/ *, */).reduce(function (obj, str) {
2379
- var parts = str.split(/ *; */);
2380
- var url = parts[0].slice(1, -1);
2381
- var rel = parts[1].split(/ *= */)[1].slice(1, -1);
2382
- obj[rel] = url;
2383
- return obj;
2384
- }, {});
3224
+ exports.parseLinks = function (val) {
3225
+ var obj = {};
3226
+
3227
+ var _iterator2 = _createForOfIteratorHelper(val.split(/ *, */)),
3228
+ _step2;
3229
+
3230
+ try {
3231
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3232
+ var str = _step2.value;
3233
+ var parts = str.split(/ *; */);
3234
+ var url = parts[0].slice(1, -1);
3235
+ var rel = parts[1].split(/ *= */)[1].slice(1, -1);
3236
+ obj[rel] = url;
3237
+ }
3238
+ } catch (err) {
3239
+ _iterator2.e(err);
3240
+ } finally {
3241
+ _iterator2.f();
3242
+ }
3243
+
3244
+ return obj;
2385
3245
  };
2386
3246
  /**
2387
3247
  * Strip content related fields from `header`.
@@ -2406,5 +3266,5 @@ exports.cleanHeader = function (header, changesOrigin) {
2406
3266
  return header;
2407
3267
  };
2408
3268
 
2409
- },{}]},{},[5])(5)
3269
+ },{}]},{},[10])(10)
2410
3270
  });