MCPcopy Index your code
hub / github.com/0xUnixIO/pulse / writeJSON

Function writeJSON

internal/serverapi/api.go:865–871  ·  view source on GitHub ↗
(w http.ResponseWriter, status int, payload any)

Source from the content-addressed store, hash-verified

863}
864
865func writeJSON(w http.ResponseWriter, status int, payload any) {
866 w.Header().Set("Content-Type", "application/json; charset=utf-8")
867 w.WriteHeader(status)
868 if err := json.NewEncoder(w).Encode(payload); err != nil {
869 http.Error(w, err.Error(), http.StatusInternalServerError)
870 }
871}
872
873// internalError 记录完整错误到日志,并向客户端返回通用 500 响应,避免内部细节泄露。
874func internalError(w http.ResponseWriter, r *http.Request, err error) {

Callers 15

saveTracerouteResultMethod · 0.70
listTracerouteResultsMethod · 0.70
handleSetupStatusMethod · 0.70
handleSetupMethod · 0.70
RegisterEnrollEndpointFunction · 0.70
handleNodesMethod · 0.70
handleNodeRoutesMethod · 0.70
handleNodeMethod · 0.70
handleNodeRuntimeMethod · 0.70

Calls 2

WriteHeaderMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected