Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Apr 26, 2024
1 parent 8cd429a commit 5490b32
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cookie/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function serializeCookie(name: string, value: string, attributes: CookieA
if (attributes?.expires !== undefined) {
keyValueEntries.push(["Expires", attributes.expires.toUTCString()]);
}
if (attributes?.httpOnly) {
if (attributes?.httpOnly === true) {
keyValueEntries.push(["HttpOnly"]);
}
if (attributes?.maxAge !== undefined) {
Expand All @@ -37,7 +37,7 @@ export function serializeCookie(name: string, value: string, attributes: CookieA
if (attributes?.sameSite === "strict") {
keyValueEntries.push(["SameSite", "Strict"]);
}
if (attributes?.secure) {
if (attributes?.secure === true) {
keyValueEntries.push(["Secure"]);
}
return keyValueEntries.map((pair) => pair.join("=")).join("; ");
Expand All @@ -50,7 +50,9 @@ export function parseCookies(header: string): Map<string, string> {
const pair = item.split("=");
const rawKey = pair[0];
const rawValue = pair[1] ?? "";
if (!rawKey) continue;
if (!rawKey) {
continue;
}
cookies.set(decodeURIComponent(rawKey), decodeURIComponent(rawValue));
}
return cookies;
Expand Down

0 comments on commit 5490b32

Please sign in to comment.