示例#1
0
func PutCook(w http.ResponseWriter, r *http.Request) {
	count++
	key := fmt.Sprintf("KEY %d", count)
	val := fmt.Sprintf("VALUE %d", count)
	cook.Put(w, key, val)
	fmt.Fprintf(w, "Set Cookie: %s, %s", key, val)
	return
}
示例#2
0
func SetFlash(w http.ResponseWriter, kind, msg string) {
	cook.Put(w, "flash", kind+":"+msg)
}
示例#3
0
func SetCSRF(w http.ResponseWriter) string {
	csrf := Random(32)
	cook.Put(w, "C", csrf)
	return csrf
}