MCPcopy Create free account
hub / github.com/crewjam/saml / HandleListSessions

Method HandleListSessions

samlidp/session.go:152–162  ·  view source on GitHub ↗

HandleListSessions handles the `GET /sessions/` request and responds with a JSON formatted list of session names.

(c web.C, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

150// HandleListSessions handles the `GET /sessions/` request and responds with a JSON formatted list
151// of session names.
152func (s *Server) HandleListSessions(c web.C, w http.ResponseWriter, r *http.Request) {
153 sessions, err := s.Store.List("/sessions/")
154 if err != nil {
155 http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
156 return
157 }
158
159 json.NewEncoder(w).Encode(struct {
160 Sessions []string `json:"sessions"`
161 }{Sessions: sessions})
162}
163
164// HandleGetSession handles the `GET /sessions/:id` request and responds with the session
165// object in JSON format.

Callers

nothing calls this directly

Calls 3

ListMethod · 0.65
EncodeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected