MCPcopy
hub / github.com/usefathom/fathom / DeleteSession

Method DeleteSession

pkg/api/auth.go:82–93  ·  view source on GitHub ↗

URL: DELETE /api/session

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

80
81// URL: DELETE /api/session
82func (api *API) DeleteSession(w http.ResponseWriter, r *http.Request) error {
83 session, _ := api.sessions.Get(r, "auth")
84 if !session.IsNew {
85 session.Options.MaxAge = -1
86 err := session.Save(r, w)
87 if err != nil {
88 return err
89 }
90 }
91
92 return respond(w, http.StatusOK, envelope{Data: true})
93}
94
95// Authorize is middleware that aborts the request if unauthorized
96func (api *API) Authorize(next http.Handler) http.Handler {

Callers

nothing calls this directly

Calls 1

respondFunction · 0.85

Tested by

no test coverage detected