We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 207de77 + 1730d38 commit f6e3097Copy full SHA for f6e3097
cookiejar.js
@@ -67,11 +67,22 @@
67
if (this instanceof Cookie) {
68
var parts = str.split(";").filter(function (value) {
69
return !!value;
70
- }),
71
- pair = parts[0].match(/([^=]+)=([\s\S]*)/),
72
- key = pair[1],
73
- value = pair[2],
74
- i;
+ });
+ var i;
+
+ var pair = parts[0].match(/([^=]+)=([\s\S]*)/);
+ if (!pair) {
75
+ console.warn("Invalid cookie header encountered. Header: '"+str+"'");
76
+ return;
77
+ }
78
79
+ var key = pair[1];
80
+ var value = pair[2];
81
+ if ( typeof key !== 'string' || key.length === 0 || typeof value !== 'string' ) {
82
+ console.warn("Unable to extract values from cookie header. Cookie: '"+str+"'");
83
84
85
86
this.name = key;
87
this.value = value;
88
0 commit comments