From f31aeab1bc9edc45cc88d1d13a109e31c80d2ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20=C3=81lvarez?= <86166683+ralvarezdev@users.noreply.github.com> Date: Sat, 1 Feb 2025 15:33:44 -0400 Subject: [PATCH] refactor: moved ExpiresAt field from cookies Attributes struct to SetCookie function as a parameter --- http/cookie/cookie.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/http/cookie/cookie.go b/http/cookie/cookie.go index 9ae31bc..a22a9e4 100644 --- a/http/cookie/cookie.go +++ b/http/cookie/cookie.go @@ -7,13 +7,12 @@ import ( // Attributes is the structure for the attributes of a cookie type Attributes struct { - Name string - Path string - Domain string - ExpiresAt time.Time - Secure bool - HTTPOnly bool - SameSite http.SameSite + Name string + Path string + Domain string + Secure bool + HTTPOnly bool + SameSite http.SameSite } // SetCookie sets a cookie @@ -21,6 +20,7 @@ func SetCookie( w http.ResponseWriter, attributes *Attributes, value string, + expiresAt time.Time, ) { // Create and create cookie cookie := &http.Cookie{ @@ -28,7 +28,7 @@ func SetCookie( Value: value, Path: attributes.Path, Domain: attributes.Domain, - Expires: attributes.ExpiresAt, + Expires: expiresAt, Secure: attributes.Secure, HttpOnly: attributes.HTTPOnly, SameSite: attributes.SameSite,