W3cubDocs

/Nim

Module cookies

This module implements helper procs for parsing Cookies.

Imports

strtabs, times

Procs

proc parseCookies(s: string): StringTableRef {.raises: [], tags: [].}
parses cookies into a string table.
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=...; ...
proc setCookie(key, value: string; expires: TimeInfo; domain = ""; path = "";
              noName = false; secure = false; httpOnly = false): string {.
    raises: [ValueError], tags: [].}

Creates a command in the format of Set-Cookie: key=value; Domain=...; ...

Note: UTC is assumed as the timezone for expires.

© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/cookies.html