(r *http.Request, want string)
| 185 | } |
| 186 | |
| 187 | func 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 | |
| 199 | func (s *Server) health(w http.ResponseWriter, _ *http.Request) { |
| 200 | writeJSON(w, http.StatusOK, map[string]string{ |
no outgoing calls
no test coverage detected