summaryrefslogtreecommitdiff
path: root/pkg/web
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/web')
-rw-r--r--pkg/web/cookie/new.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/pkg/web/cookie/new.go b/pkg/web/cookie/new.go
index f4b049e..c255818 100644
--- a/pkg/web/cookie/new.go
+++ b/pkg/web/cookie/new.go
@@ -5,11 +5,11 @@ import (
"time"
"github.com/xlgmokha/x/pkg/env"
- "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls"
+ "github.com/xlgmokha/x/pkg/x"
)
-func New(name, value string, options ...pls.Option[*http.Cookie]) *http.Cookie {
- options = pls.Prepend[pls.Option[*http.Cookie]](
+func New(name, value string, options ...x.Option[*http.Cookie]) *http.Cookie {
+ options = x.Prepend[x.Option[*http.Cookie]](
options,
With(func(c *http.Cookie) {
c.Name = name
@@ -21,47 +21,47 @@ func New(name, value string, options ...pls.Option[*http.Cookie]) *http.Cookie {
WithSameSite(http.SameSiteStrictMode),
WithDomain(env.Fetch("HOST", "localhost")),
)
- return pls.New[*http.Cookie](options...)
+ return x.New[*http.Cookie](options...)
}
-func With(with func(*http.Cookie)) pls.Option[*http.Cookie] {
+func With(with func(*http.Cookie)) x.Option[*http.Cookie] {
return func(c *http.Cookie) *http.Cookie {
with(c)
return c
}
}
-func WithPath(value string) pls.Option[*http.Cookie] {
+func WithPath(value string) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.Path = value
})
}
-func WithHttpOnly(value bool) pls.Option[*http.Cookie] {
+func WithHttpOnly(value bool) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.HttpOnly = value
})
}
-func WithSecure(value bool) pls.Option[*http.Cookie] {
+func WithSecure(value bool) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.Secure = value
})
}
-func WithDomain(value string) pls.Option[*http.Cookie] {
+func WithDomain(value string) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.Domain = value
})
}
-func WithSameSite(value http.SameSite) pls.Option[*http.Cookie] {
+func WithSameSite(value http.SameSite) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.SameSite = value
})
}
-func WithExpiration(expires time.Time) pls.Option[*http.Cookie] {
+func WithExpiration(expires time.Time) x.Option[*http.Cookie] {
return With(func(c *http.Cookie) {
c.Expires = expires
c.MaxAge = int(time.Until(expires).Seconds())