MCPcopy
hub / github.com/mudler/LocalAI / writePIIBlocked

Function writePIIBlocked

core/services/cloudproxy/mitm/handler.go:313–324  ·  view source on GitHub ↗
(w http.ResponseWriter, correlationID string)

Source from the content-addressed store, hash-verified

311}
312
313func 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
326func isSSE(contentType string) bool {
327 return strings.HasPrefix(strings.TrimSpace(contentType), "text/event-stream")

Callers 1

serveMethod · 0.85

Calls 4

HeaderMethod · 0.80
EncodeMethod · 0.80
SetMethod · 0.65
WriteHeaderMethod · 0.45

Tested by

no test coverage detected