(r *http.Request)
| 135 | } |
| 136 | |
| 137 | func extractToken(r *http.Request) (token, source string) { |
| 138 | if auth := r.Header.Get("Authorization"); auth != "" { |
| 139 | if strings.HasPrefix(auth, "Bearer ") { |
| 140 | return strings.TrimPrefix(auth, "Bearer "), "header" |
| 141 | } |
| 142 | } |
| 143 | if c, err := r.Cookie("token"); err == nil { |
| 144 | return c.Value, "cookie" |
| 145 | } |
| 146 | return "", "" |
| 147 | } |
no test coverage detected