MCPcopy Create free account
hub / github.com/dnote/dnote / getSessionKeyFromCookie

Function getSessionKeyFromCookie

pkg/server/controllers/helpers.go:106–116  ·  view source on GitHub ↗

getSessionKeyFromCookie reads and returns a session key from the cookie sent by the request. If no session key is found, it returns an empty string

(r *http.Request)

Source from the content-addressed store, hash-verified

104// getSessionKeyFromCookie reads and returns a session key from the cookie sent by the
105// request. If no session key is found, it returns an empty string
106func getSessionKeyFromCookie(r *http.Request) (string, error) {
107 c, err := r.Cookie("id")
108
109 if err == http.ErrNoCookie {
110 return "", nil
111 } else if err != nil {
112 return "", errors.Wrap(err, "reading cookie")
113 }
114
115 return c.Value, nil
116}
117
118// getSessionKeyFromAuth reads and returns a session key from the Authorization header
119func getSessionKeyFromAuth(r *http.Request) (string, error) {

Callers 1

GetCredentialFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected