Skip to content

Commit

Permalink
http/cookie: fixing equal character split (denoland/std#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth authored and ry committed Apr 29, 2019
1 parent ce101a0 commit a814cfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion http/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function getCookies(req: ServerRequest): Cookies {
for (const kv of c) {
const cookieVal = kv.split("=");
const key = cookieVal.shift().trim();
out[key] = cookieVal.join("");
out[key] = cookieVal.join("=");
}
return out;
}
Expand Down
8 changes: 8 additions & 0 deletions http/cookie_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ test({
req.headers = new Headers();
req.headers.set("Cookie", "igot=99; problems=but...");
assertEquals(getCookies(req), { igot: "99", problems: "but..." });

req.headers = new Headers();
req.headers.set("Cookie", "PREF=al=en-GB&f1=123; wide=1; SID=123");
assertEquals(getCookies(req), {
PREF: "al=en-GB&f1=123",
wide: "1",
SID: "123"
});
}
});

Expand Down

0 comments on commit a814cfc

Please sign in to comment.