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

Function writeJSON

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

Source from the content-addressed store, hash-verified

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

Callers 6

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

Calls 3

WriteMethod · 0.80
ErrorMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected