1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-10 05:25:58 +00:00

Cookies: Ability to set custom cookie encoders to encode the cookie's value before sent by ctx.SetCookie and ctx.SetCookieKV and cookie decoders to decode the cookie's value when retrieving from ctx.GetCookie. That was the second and final part relative to a community's question at: https://github.com/kataras/iris/issues/1018

Former-commit-id: 53b6810076c8db8646df335d57a30c78b23cd9b8
This commit is contained in:
Gerasimos Maropoulos
2018-06-02 16:35:18 +03:00
parent fcff62d5b4
commit b4856d542d
7 changed files with 497 additions and 69 deletions

18
iris.go
View File

@@ -444,6 +444,24 @@ var (
//
// A shortcut for the `context#CookieHTTPOnly`.
CookieHTTPOnly = context.CookieHTTPOnly
// CookieEncode is a `CookieOption`.
// Provides encoding functionality when adding a cookie.
// Accepts a `context#CookieEncoder` and sets the cookie's value to the encoded value.
// Users of that is the `context#SetCookie` and `context#SetCookieKV`.
//
// Example: https://github.com/kataras/iris/tree/master/_examples/cookies/securecookie
//
// A shortcut for the `context#CookieEncode`.
CookieEncode = context.CookieEncode
// CookieDecode is a `CookieOption`.
// Provides decoding functionality when retrieving a cookie.
// Accepts a `context#CookieDecoder` and sets the cookie's value to the decoded value before return by the `GetCookie`.
// User of that is the `context#GetCookie`.
//
// Example: https://github.com/kataras/iris/tree/master/_examples/cookies/securecookie
//
// A shortcut for the `context#CookieDecode`.
CookieDecode = context.CookieDecode
)
// SPA accepts an "assetHandler" which can be the result of an