MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / handleDelete

Method handleDelete

server/mcp/handler.go:275–295  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

273}
274
275func (s *Server) handleDelete(c *gin.Context) {
276 if !validateOrigin(c.Request) {
277 c.Status(http.StatusForbidden)
278 return
279 }
280
281 currentSession, ok := s.getSession(c.GetHeader(SessionHeader))
282 if !ok {
283 c.Status(http.StatusNotFound)
284 return
285 }
286
287 user := c.Request.Context().Value(conf.UserKey).(*model.User)
288 if currentSession.userID != user.ID {
289 c.Status(http.StatusNotFound)
290 return
291 }
292
293 s.deleteSession(currentSession.id)
294 c.Status(http.StatusNoContent)
295}
296
297func (s *Server) createSession(userID uint) *session {
298 s.mu.Lock()

Callers 1

TestDeleteRemovesSessionFunction · 0.45

Calls 4

getSessionMethod · 0.95
deleteSessionMethod · 0.95
validateOriginFunction · 0.85
StatusMethod · 0.65

Tested by 1

TestDeleteRemovesSessionFunction · 0.36