关于http的cookies保持

zhangguanzhang · · 1864 次点击
```go func setCookie(w *http.ResponseWriter) { cookie := http.Cookie{ Name: "token", Value: "hello world", HttpOnly: true, } http.SetCookie(w, &cookie) } func getCookie(r *http.Request) { token, err := r.Cookie("token") if err != nil { panic("ohh") } fmt.Println(token) } ```
#1
更多评论
没事了,我header传错了,jar那个是对的
#2