diff options
Diffstat (limited to 'pkg/web')
| -rw-r--r-- | pkg/web/cookie/new.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/pkg/web/cookie/new.go b/pkg/web/cookie/new.go index 9aed2ab..7964086 100644 --- a/pkg/web/cookie/new.go +++ b/pkg/web/cookie/new.go @@ -9,16 +9,18 @@ import ( ) func New(name, value string, options ...pls.Option[*http.Cookie]) *http.Cookie { - options = append(options, With(func(c *http.Cookie) { - c.Name = name - c.Value = value // TODO:: digitally sign the value - c.Path = "/" - c.HttpOnly = true - c.Secure = true - c.SameSite = http.SameSiteStrictMode - c.Domain = env.Fetch("HOST", "localhost") - })) - + options = pls.Prepend[pls.Option[*http.Cookie]]( + options, + With(func(c *http.Cookie) { + c.Name = name + c.Value = value // TODO:: digitally sign the value + c.Path = "/" + c.HttpOnly = true + c.Secure = true + c.SameSite = http.SameSiteStrictMode + c.Domain = env.Fetch("HOST", "localhost") + }), + ) return pls.New[*http.Cookie](options...) } |
