Struct Cookie

A cookie. Use Cookie("key", "value") to create a cookie. You can chain methods.

struct Cookie ;
auto cookie = Cookie("name", "value").path("/").domain("example.com").secure().maxAge(1.days);
output.setCookie(cookie);

Constructors

NameDescription
this (name, value) Build a cookie with name and value

Properties

NameTypeDescription
domain[set] CookieSet cookie domain
expire[set] CookieSet cookie expire time. It overrides maxAge.
httpOnly[set] CookieSet cookie httpOnly flag. This cookie will not be accessible from javascript.
invalidate[get] CookieInvalidate cookie. It will be deleted from browser on output.setCookie() request.
maxAge[set] CookieSet cookie max age. It overrides expire.
path[set] CookieSet cookie path
sameSite[set] CookieSet cookie SameSite flag
secure[set] CookieSet cookie secure flag. This cookie will be sent only thru https.

Enums

NameDescription
SameSite Cookie SameSite flag