summaryrefslogtreecommitdiff
path: root/pkg/web/cookie.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-07 09:07:52 -0700
committermo khan <mo@mokhan.ca>2025-05-07 09:07:52 -0700
commit21a694497607d886b85ddf8bb4fd1cb535387a41 (patch)
tree982e527d6011e0f791a313020764a3fef4d83a12 /pkg/web/cookie.go
parentef050c428a0a893607314a4d5d8d441e445e630a (diff)
refactor: inline options variable
Diffstat (limited to 'pkg/web/cookie.go')
-rw-r--r--pkg/web/cookie.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/web/cookie.go b/pkg/web/cookie.go
index d4b1555..1377274 100644
--- a/pkg/web/cookie.go
+++ b/pkg/web/cookie.go
@@ -9,7 +9,7 @@ import (
)
func NewCookie(name, value string, options ...x.Option[*http.Cookie]) *http.Cookie {
- options = x.Prepend[x.Option[*http.Cookie]](
+ return x.New[*http.Cookie](x.Prepend[x.Option[*http.Cookie]](
options,
cookie.WithName(name),
cookie.WithValue(value), // TODO:: digitally sign the value
@@ -18,9 +18,7 @@ func NewCookie(name, value string, options ...x.Option[*http.Cookie]) *http.Cook
cookie.WithSecure(true),
cookie.WithSameSite(http.SameSiteDefaultMode),
cookie.WithDomain(env.Fetch("HOST", "localhost")),
- )
-
- return x.New[*http.Cookie](options...)
+ )...)
}
func ExpireCookie(w http.ResponseWriter, name string) {