MCPcopy Index your code
hub / github.com/InferCore/InferCore / infercoreAuthOK

Function infercoreAuthOK

internal/server/server.go:187–197  ·  view source on GitHub ↗
(r *http.Request, want string)

Source from the content-addressed store, hash-verified

185}
186
187func infercoreAuthOK(r *http.Request, want string) bool {
188 if v := strings.TrimSpace(r.Header.Get("X-InferCore-Api-Key")); v != "" && v == want {
189 return true
190 }
191 auth := strings.TrimSpace(r.Header.Get("Authorization"))
192 fields := strings.Fields(auth)
193 if len(fields) == 2 && strings.EqualFold(fields[0], "Bearer") && fields[1] == want {
194 return true
195 }
196 return false
197}
198
199func (s *Server) health(w http.ResponseWriter, _ *http.Request) {
200 writeJSON(w, http.StatusOK, map[string]string{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected