MCPcopy Create free account
hub / github.com/buggregator/server / authMiddleware

Function authMiddleware

internal/mcp/http.go:45–54  ·  view source on GitHub ↗
(token string, next http.Handler)

Source from the content-addressed store, hash-verified

43}
44
45func authMiddleware(token string, next http.Handler) http.Handler {
46 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
47 auth := r.Header.Get("Authorization")
48 if auth != "Bearer "+token {
49 http.Error(w, "Unauthorized", http.StatusUnauthorized)
50 return
51 }
52 next.ServeHTTP(w, r)
53 })
54}

Callers 3

StartHTTPFunction · 0.85
RegisterAPIFunction · 0.85

Calls 2

ServeHTTPMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected