diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-30 12:37:34 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-30 12:37:34 -0600 |
| commit | 1b8c0cd2283d0b7e24e57d86c9529d97f0879169 (patch) | |
| tree | ee3b6fcf3859d79f90da43d616736902c9befe8a /pkg/web | |
| parent | 1b5437dc91a91a6946bffb5e43e098b936284c62 (diff) | |
feat: extract other cookie options
Diffstat (limited to 'pkg/web')
| -rw-r--r-- | pkg/web/cookie/new.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/web/cookie/new.go b/pkg/web/cookie/new.go index 7964086..cbca724 100644 --- a/pkg/web/cookie/new.go +++ b/pkg/web/cookie/new.go @@ -31,6 +31,30 @@ func With(with func(*http.Cookie)) pls.Option[*http.Cookie] { } } +func WithPath(value string) pls.Option[*http.Cookie] { + return With(func(c *http.Cookie) { + c.Path = value + }) +} + +func WithHttpOnly(value bool) pls.Option[*http.Cookie] { + return With(func(c *http.Cookie) { + c.HttpOnly = value + }) +} + +func WithSecure(value bool) pls.Option[*http.Cookie] { + return With(func(c *http.Cookie) { + c.Secure = value + }) +} + +func WithDomain(value string) pls.Option[*http.Cookie] { + return With(func(c *http.Cookie) { + c.Domain = value + }) +} + func WithSameSite(value http.SameSite) pls.Option[*http.Cookie] { return With(func(c *http.Cookie) { c.SameSite = value |
