cookie.go 289 B

123456789101112131415
  1. package myth
  2. import "net/http"
  3. // SetCookie set http cookie
  4. func SetCookie(w http.ResponseWriter, name, value, path string, maxAge int) {
  5. cookie := &http.Cookie{
  6. Name: name,
  7. Value: value,
  8. Path: path,
  9. HttpOnly: false,
  10. MaxAge: maxAge}
  11. http.SetCookie(w, cookie)
  12. }