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

Function writeJSON

internal/agent/api.go:48–52  ·  view source on GitHub ↗

writeJSON encodes payload as the response body. Logs encoding errors rather than swallowing them — an Encode failure usually means the client closed the connection mid-response or the payload contains a non-marshalable value, both of which are useful to surface in logs when debugging truncated respo

(w http.ResponseWriter, payload any)

Source from the content-addressed store, hash-verified

46// non-marshalable value, both of which are useful to surface in logs
47// when debugging truncated responses.
48func writeJSON(w http.ResponseWriter, payload any) {
49 if err := json.NewEncoder(w).Encode(payload); err != nil {
50 log.Printf("[api] json encode failed: %v", err)
51 }
52}
53
54// readJSON wraps the request body in a MaxBytesReader and decodes into
55// dst. Use this for every JSON-decoding handler to bound memory and

Callers 2

handleHealthMethod · 0.70
handleFeedbackMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected