(w http.ResponseWriter, correlationID string)
| 311 | } |
| 312 | |
| 313 | func writePIIBlocked(w http.ResponseWriter, correlationID string) { |
| 314 | w.Header().Set("Content-Type", "application/json") |
| 315 | w.WriteHeader(http.StatusBadRequest) |
| 316 | resp := map[string]any{ |
| 317 | "error": map[string]string{ |
| 318 | "message": "request blocked by LocalAI MITM proxy (sensitive data detected)", |
| 319 | "type": "pii_blocked", |
| 320 | }, |
| 321 | "correlation_id": correlationID, |
| 322 | } |
| 323 | _ = json.NewEncoder(w).Encode(resp) |
| 324 | } |
| 325 | |
| 326 | func isSSE(contentType string) bool { |
| 327 | return strings.HasPrefix(strings.TrimSpace(contentType), "text/event-stream") |
no test coverage detected