msw 0.36.8 → 0.38.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.
@@ -656,7 +656,6 @@ var serialize_1 = serialize;
656
656
 
657
657
  var decode = decodeURIComponent;
658
658
  var encode = encodeURIComponent;
659
- var pairSplitRegExp = /; */;
660
659
 
661
660
  /**
662
661
  * RegExp to match field-content in RFC 7230 sec 3.2
@@ -687,28 +686,29 @@ function parse(str, options) {
687
686
 
688
687
  var obj = {};
689
688
  var opt = options || {};
690
- var pairs = str.split(pairSplitRegExp);
689
+ var pairs = str.split(';');
691
690
  var dec = opt.decode || decode;
692
691
 
693
692
  for (var i = 0; i < pairs.length; i++) {
694
693
  var pair = pairs[i];
695
- var eq_idx = pair.indexOf('=');
694
+ var index = pair.indexOf('=');
696
695
 
697
696
  // skip things that don't look like key=value
698
- if (eq_idx < 0) {
697
+ if (index < 0) {
699
698
  continue;
700
699
  }
701
700
 
702
- var key = pair.substr(0, eq_idx).trim();
703
- var val = pair.substr(++eq_idx, pair.length).trim();
704
-
705
- // quoted values
706
- if ('"' == val[0]) {
707
- val = val.slice(1, -1);
708
- }
701
+ var key = pair.substring(0, index).trim();
709
702
 
710
703
  // only assign once
711
704
  if (undefined == obj[key]) {
705
+ var val = pair.substring(index + 1, pair.length).trim();
706
+
707
+ // quoted values
708
+ if (val[0] === '"') {
709
+ val = val.slice(1, -1);
710
+ }
711
+
712
712
  obj[key] = tryDecode(val, dec);
713
713
  }
714
714
  }