MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / readJSON

Function readJSON

internal/agent/api.go:60–63  ·  view source on GitHub ↗

readJSON wraps the request body in a MaxBytesReader and decodes into dst. Use this for every JSON-decoding handler to bound memory and reject obviously oversized payloads early. We deliberately do not DisallowUnknownFields — adding it would break existing clients that send forward-compatible extra f

(w http.ResponseWriter, r *http.Request, dst any, maxBytes int64)

Source from the content-addressed store, hash-verified

58// send forward-compatible extra fields, and the SDKs publish typed
59// requests so unknown-fields strictness adds little defense.
60func readJSON(w http.ResponseWriter, r *http.Request, dst any, maxBytes int64) error {
61 r.Body = http.MaxBytesReader(w, r.Body, maxBytes)
62 return json.NewDecoder(r.Body).Decode(dst)
63}
64
65// normalizeEmail is the agent-package-local alias for identity.NormalizeEmail.
66// Defined here as a one-line forwarder so the existing call sites in this

Callers 1

handleFeedbackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected