Setting up Cookies at browser : Golang

1 view
Skip to first unread message

Neo via StackOverflow

unread,
Nov 12, 2015, 10:29:12 AM11/12/15
to google-appengin...@googlegroups.com

cookie := http.Cookie{"test", "tcookie", "/", "www.dummy.com", expire, expire.Format(time.UnixDate), 86400, true, true, "test=tcookie", []string{"test=tcookie"}}

should be something like this:

cookie := &http.Cookie{Name:"test", Value:"tcookie", Expires:time.Now().Add(356*24*time.Hour), HttpOnly:true}

after this

change

req.AddCookie(&cookie)

to

http.SetCookie(w, cookie)

and finally because your application is running on Google App Engine change:

func main()

to

func init()



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/17086065/setting-up-cookies-at-browser-golang/17103138#17103138
Reply all
Reply to author
Forward
0 new messages