Skip to content

Commit 46dabdc

Browse files
committed
Warn when cookie header is invalid
1 parent 544d394 commit 46dabdc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cookiejar.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,17 @@
7171
var i;
7272

7373
var pair = parts[0].match(/([^=]+)=([\s\S]*)/);
74-
if (!pair) return;
74+
if (!pair) {
75+
console.warn(`Invalid cookie header encountered. Header: '${str}'`)
76+
return;
77+
}
7578

7679
var key = pair[1];
7780
var value = pair[2];
78-
if (!key || !value) return;
81+
if (!key || !value) {
82+
console.warn(`Unable to extract values from cookie header. Cookie: '${str}'`)
83+
return;
84+
}
7985

8086
this.name = key;
8187
this.value = value;

0 commit comments

Comments
 (0)