package dethnote import "net/http" // SetCookie sets a cookie. func (s *Server) SetCookie(w http.ResponseWriter, name, value string) { http.SetCookie(w, &http.Cookie{ Name: name, Value: value, Path: "/", HttpOnly: true, }) } // GetCookie reads a cookie. func (s *Server) GetCookie(r *http.Request, name string) string { cookie, _ := r.Cookie(name) if cookie != nil { return cookie.Value } return "" }