MCPcopy Index your code
hub / github.com/dnote/dnote / UnsetSessionCookie

Function UnsetSessionCookie

pkg/server/middleware/helpers.go:58–70  ·  view source on GitHub ↗

UnsetSessionCookie unsets the session cookie

(w http.ResponseWriter)

Source from the content-addressed store, hash-verified

56
57// UnsetSessionCookie unsets the session cookie
58func UnsetSessionCookie(w http.ResponseWriter) {
59 expire := time.Now().Add(time.Hour * -24 * 30)
60 cookie := http.Cookie{
61 Name: "id",
62 Value: "",
63 Expires: expire,
64 Path: "/",
65 HttpOnly: true,
66 }
67
68 w.Header().Set("Cache-Control", "no-cache")
69 http.SetCookie(w, &cookie)
70}
71
72// DoError logs the error and responds with the given status code with a generic status text
73func DoError(w http.ResponseWriter, msg string, err error, statusCode int) {

Callers 1

RespondUnauthorizedFunction · 0.85

Calls 1

NowMethod · 0.65

Tested by

no test coverage detected