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)
| 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 |
| 106 | func 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 |
| 119 | func getSessionKeyFromAuth(r *http.Request) (string, error) { |