This module implements helper procs for parsing Cookies.
Procs
proc parseCookies(s: string): StringTableRef {...}{.raises: [], tags: [].}
-
parses cookies into a string table.
The proc is meant to parse the Cookie header set by a client, not the "Set-Cookie" header set by servers.
Example:
doAssert parseCookies("a=1; foo=bar") == {"a": 1, "foo": "bar"}.newStringTable
Source Edit proc setCookie(key, value: string; domain = ""; path = ""; expires = ""; noName = false; secure = false; httpOnly = false): string {...}{.raises: [], tags: [].}
- Creates a command in the format of Set-Cookie: key=value; Domain=...; ... Source Edit
proc setCookie(key, value: string; expires: DateTime | Time; domain = ""; path = ""; noName = false; secure = false; httpOnly = false): string
- Creates a command in the format of Set-Cookie: key=value; Domain=...; ... Source Edit