From a62d2287aed75d375ffa7754b1a23c37dc40517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Wed, 8 May 2024 17:51:41 +0200 Subject: [PATCH] Added X-Session-ID cookie --- session.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/session.go b/session.go index 5608ab7..7b4afc7 100644 --- a/session.go +++ b/session.go @@ -75,6 +75,13 @@ func (service *Service) sessionNew(w http.ResponseWriter, r *http.Request, foo * }, ) + cookie := http.Cookie{} + cookie.Name = "X-Session-ID" + cookie.Value = sess.UUID + cookie.MaxAge = 86400 * 365 + cookie.Path = "/" + http.SetCookie(w, &cookie) + w.Write(respJSON) } // }}} func (service *Service) sessionAuthenticate(w http.ResponseWriter, r *http.Request, sess *session.T) { // {{{