MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / bearerToken

Function bearerToken

internal/ws/handler.go:133–140  ·  view source on GitHub ↗

bearerToken extracts the API key from the `Authorization: Bearer ` handshake header (scheme match is case-insensitive per RFC 7235). Returns "" when the header is absent or not a Bearer credential.

(r *http.Request)

Source from the content-addressed store, hash-verified

131// handshake header (scheme match is case-insensitive per RFC 7235). Returns ""
132// when the header is absent or not a Bearer credential.
133func bearerToken(r *http.Request) string {
134 h := r.Header.Get("Authorization")
135 const prefix = "Bearer "
136 if len(h) < len(prefix) || !strings.EqualFold(h[:len(prefix)], prefix) {
137 return ""
138 }
139 return strings.TrimSpace(h[len(prefix):])
140}
141
142// drainUnread sends notifications for all unread messages. Notifications are
143// best-effort; messages are marked read only when fetched via the REST API.

Callers 1

serveMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected