This module implements helper procs for parsing Cookies.
proc parseCookies(s: string): StringTableRef {....raises: [], tags: [], forbids: [].}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:
import std/strtabs
let cookieJar = parseCookies("a=1; foo=bar")
assert cookieJar["a"] == "1"
assert cookieJar["foo"] == "bar" Source Edit proc setCookie(key, value: string; domain = ""; path = ""; expires = "";
noName = false; secure = false; httpOnly = false;
maxAge = none(int); sameSite = SameSite.Default): string {.
...raises: [], tags: [], forbids: [].}Set-Cookie: key=value; Domain=...; ...secure=true, httpOnly=true and sameSite=Strict.
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/cookies.html