Function
persistAlert
(w http.ResponseWriter, alert Alert)
Source from the content-addressed store, hash-verified
| 100 | } |
| 101 | |
| 102 | func persistAlert(w http.ResponseWriter, alert Alert) { |
| 103 | expiresAt := time.Now().Add(5 * time.Minute) |
| 104 | lvl := http.Cookie{ |
| 105 | Name: "alert_level", |
| 106 | Value: alert.Level, |
| 107 | Expires: expiresAt, |
| 108 | Path: "/", |
| 109 | HttpOnly: true, |
| 110 | } |
| 111 | msg := http.Cookie{ |
| 112 | Name: "alert_message", |
| 113 | Value: alert.Message, |
| 114 | Expires: expiresAt, |
| 115 | Path: "/", |
| 116 | HttpOnly: true, |
| 117 | } |
| 118 | http.SetCookie(w, &lvl) |
| 119 | http.SetCookie(w, &msg) |
| 120 | } |
| 121 | |
| 122 | func clearAlert(w http.ResponseWriter) { |
| 123 | lvl := http.Cookie{ |
Tested by
no test coverage detected