MCPcopy Create free account
hub / github.com/astercloud/aster / writeJSON

Function writeJSON

pkg/desktop/utils.go:29–33  ·  view source on GitHub ↗

writeJSON writes a JSON response

(w http.ResponseWriter, status int, v any)

Source from the content-addressed store, hash-verified

27
28// writeJSON writes a JSON response
29func writeJSON(w http.ResponseWriter, status int, v any) {
30 w.Header().Set("Content-Type", "application/json")
31 w.WriteHeader(status)
32 _ = json.NewEncoder(w).Encode(v) // Ignore write errors after status sent
33}
34
35// corsMiddleware adds CORS headers
36func corsMiddleware(next http.Handler) http.Handler {

Callers 15

handleChatMethod · 0.70
handleCancelMethod · 0.70
handleApproveMethod · 0.70
handleStatusMethod · 0.70
handleHistoryMethod · 0.70
handleConfigMethod · 0.70
handleAgentsMethod · 0.70
handleChatMethod · 0.70
handleCancelMethod · 0.70
handleApproveMethod · 0.70
handleStatusMethod · 0.70
handleHistoryMethod · 0.70

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected