From 21a694497607d886b85ddf8bb4fd1cb535387a41 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 7 May 2025 09:07:52 -0700 Subject: refactor: inline options variable --- pkg/web/cookie.go | 6 ++---- 1 file 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) { -- cgit v1.2.3