MCPcopy Create free account
hub / github.com/coder/aibridge / ExtractBearerToken

Function ExtractBearerToken

utils/auth.go:6–14  ·  view source on GitHub ↗

ExtractBearerToken extracts the token from a "Bearer " authorization header.

(auth string)

Source from the content-addressed store, hash-verified

4
5// ExtractBearerToken extracts the token from a "Bearer <token>" authorization header.
6func ExtractBearerToken(auth string) string {
7 if auth := strings.TrimSpace(auth); auth != "" {
8 fields := strings.Fields(auth)
9 if len(fields) == 2 && strings.EqualFold(fields[0], "Bearer") {
10 return fields[1]
11 }
12 }
13 return ""
14}

Callers 4

TestExtractBearerTokenFunction · 0.92
CreateInterceptorMethod · 0.92
CreateInterceptorMethod · 0.92
CreateInterceptorMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestExtractBearerTokenFunction · 0.74