MCPcopy Create free account
hub / github.com/akash-network/provider / writeJSON

Function writeJSON

operator/psutil.go:233–246  ·  view source on GitHub ↗
(w http.ResponseWriter, obj interface{})

Source from the content-addressed store, hash-verified

231}
232
233func writeJSON(w http.ResponseWriter, obj interface{}) {
234 bytes, err := json.Marshal(obj)
235 if err != nil {
236 http.Error(w, err.Error(), http.StatusInternalServerError)
237 return
238 }
239
240 w.Header().Set("Content-Type", "application/json; charset=UTF-8")
241
242 _, err = w.Write(bytes)
243 if err != nil {
244 return
245 }
246}

Callers 6

infoHandlerFunction · 0.70
cpuInfoHandlerFunction · 0.70
gpuHandlerFunction · 0.70
memoryHandlerFunction · 0.70
pciHandlerFunction · 0.70
infinibandHandlerFunction · 0.70

Calls 2

SetMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected