Contextprovides some helpers to make the most common use cases of cookies easier accessible to you and without any custom additional code of yours that would be required if you just using the Request's Cookies methods.
UpsertCookiemethods add or set (replaces if necessary) a cookie.
CookieOptioncan be used to modify the "cookie". You'll see later on what the available options are, custom ones can be added depending on your web application requirements, this also helps to not repeat yourself in a codebase.
SetCookieKVmethod which does not require an import of the
SetCookieKVis 365 days. You can either use the
CookieExpiresCookie Option(see below) or globally by setting the
CookieOptionis just a type for
HttpOnly field defaults to true for
CookieEncoderand sets the cookie's value to the encoded value.
CookieDecoderand sets the cookie's value to the decoded value before return by the
CookieEncodercan be described as:
GetCookiereturns cookie's value by its name, returns empty string if nothing was found.
ctx.Request().Cookies()method returns a slice of all the available request cookies. Sometimes you want to modify them or perform an action on each one of them, the easiet way to do that is by the
RemoveCookiemethod deletes a cookie by its name and path = "/", the root one.
iris.CookieCleanPathCookie Options, as :
HttpOnlyto true. It performs a removal of cookie based on the web standards.