fix: set DestroySession MaxAge to -1 instead of -1*time.Second (closes #39)
The gorilla/sessions MaxAge field expects seconds, not nanoseconds. Previously MaxAge was set to -1000000000 (-1 * time.Second in nanoseconds), which worked by accident since any negative value deletes the cookie. Changed to the conventional value of -1.
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/sessions"
|
||||
"go.uber.org/fx"
|
||||
@@ -269,7 +268,7 @@ func (svc *Service) DestroySession(
|
||||
return fmt.Errorf("failed to get session: %w", err)
|
||||
}
|
||||
|
||||
session.Options.MaxAge = -1 * int(time.Second)
|
||||
session.Options.MaxAge = -1
|
||||
|
||||
saveErr := session.Save(request, respWriter)
|
||||
if saveErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user