diff options
Diffstat (limited to 'std/http/cookie_test.ts')
-rw-r--r-- | std/http/cookie_test.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/std/http/cookie_test.ts b/std/http/cookie_test.ts index bc45b2996..09d6764af 100644 --- a/std/http/cookie_test.ts +++ b/std/http/cookie_test.ts @@ -66,6 +66,44 @@ Deno.test({ }); Deno.test({ + name: "Cookie Value Validation", + fn(): void { + const res: Response = {}; + const tokens = [ + "1f\tWa", + "\t", + "1f Wa", + "1f;Wa", + '"1fWa', + "1f\\Wa", + '1f"Wa', + '"', + "1fWa\u0005", + "1f\u0091Wa", + ]; + res.headers = new Headers(); + tokens.forEach((value) => { + assertThrows( + (): void => { + setCookie( + res, + { + name: "Space", + value, + httpOnly: true, + secure: true, + maxAge: 3, + }, + ); + }, + Error, + "RFC2616 cookie 'Space'", + ); + }); + }, +}); + +Deno.test({ name: "Cookie Path Validation", fn(): void { const res: Response = {}; |