MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / writeJSON

Function writeJSON

internal/server/server.go:1320–1326  ·  view source on GitHub ↗
(w http.ResponseWriter, status int, payload any)

Source from the content-addressed store, hash-verified

1318}
1319
1320func writeJSON(w http.ResponseWriter, status int, payload any) {
1321 w.Header().Set("Content-Type", "application/json; charset=utf-8")
1322 w.WriteHeader(status)
1323 if err := json.NewEncoder(w).Encode(payload); err != nil {
1324 http.Error(w, err.Error(), http.StatusInternalServerError)
1325 }
1326}
1327
1328// adminStoreAdapter 将 users.Store 适配为 auth.AdminStore 接口。
1329type adminStoreAdapter struct{ s users.Store }

Callers 1

RunFunction · 0.70

Calls 2

WriteHeaderMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected