From 632313adc6a619e464b4f7cbaeccbb5019afb729 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Fri, 8 Mar 2024 08:38:55 +1100 Subject: [PATCH] docs(http): prepare for `noUncheckedIndexedAccess` --- http/unstable_signed_cookie.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http/unstable_signed_cookie.ts b/http/unstable_signed_cookie.ts index faf61fb4cbe6..7fb617819870 100644 --- a/http/unstable_signed_cookie.ts +++ b/http/unstable_signed_cookie.ts @@ -63,6 +63,7 @@ export async function signCookie( * Cookie: "location=tokyo.37f7481039762eef5cd46669f93c0a3214dfecba7d0cdc0b0dc40036063fb22e", * }); * const signedCookie = getCookies(headers)["location"]; + * if (signedCookie === undefined) throw new Error("Cookie not found"); * await verifyCookie(signedCookie, key); * ``` */ @@ -99,6 +100,7 @@ export async function verifyCookie( * Cookie: "location=tokyo.37f7481039762eef5cd46669f93c0a3214dfecba7d0cdc0b0dc40036063fb22e", * }); * const signedCookie = getCookies(headers)["location"]; + * if (signedCookie === undefined) throw new Error("Cookie not found"); * await verifyCookie(signedCookie, key); * const cookie = parseSignedCookie(signedCookie); * ```