MCPcopy
hub / github.com/harness/harness / JSON

Function JSON

app/api/render/render.go:52–56  ·  view source on GitHub ↗

JSON writes the json-encoded value to the response with the provides status.

(w http.ResponseWriter, code int, v interface{})

Source from the content-addressed store, hash-verified

50// JSON writes the json-encoded value to the response
51// with the provides status.
52func JSON(w http.ResponseWriter, code int, v interface{}) {
53 setCommonHeaders(w)
54 w.WriteHeader(code)
55 writeJSON(w, v)
56}
57
58// Reader reads the content from the provided reader and writes it as is to the response body.
59// NOTE: If no content-type header is added beforehand, the content-type will be deduced

Callers 15

RenderResourceFunction · 0.92
HandleFindFunction · 0.92
HandleUpdateFunction · 0.92
HandleCreateFunction · 0.92
HandleListFunction · 0.92
HandleFindFunction · 0.92
HandleListFunction · 0.92
HandleRevertFunction · 0.92
HandleCommentUpdateFunction · 0.92
HandleDeleteBranchFunction · 0.92
HandleFindFunction · 0.92

Calls 3

setCommonHeadersFunction · 0.85
writeJSONFunction · 0.85
WriteHeaderMethod · 0.45

Tested by 1

TestWriteJSONFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…