MCPcopy
hub / github.com/cloudflare/cloudflared / respondWithJSON

Function respondWithJSON

cmd/cloudflared/updater/workers_service_test.go:28–34  ·  view source on GitHub ↗
(w http.ResponseWriter, v interface{}, status int)

Source from the content-addressed store, hash-verified

26var testFilePath = filepath.Join(os.TempDir(), "test")
27
28func respondWithJSON(w http.ResponseWriter, v interface{}, status int) {
29 data, _ := json.Marshal(v)
30
31 w.Header().Set("Content-Type", "application/json")
32 w.WriteHeader(status)
33 w.Write(data)
34}
35
36func respondWithData(w http.ResponseWriter, b []byte, status int) {
37 w.Header().Set("Content-Type", "application/octet-stream")

Callers 3

updateHandlerFunction · 0.70
gzipUpdateHandlerFunction · 0.70
failureHandlerFunction · 0.70

Calls 5

WriteMethod · 0.65
MarshalMethod · 0.45
SetMethod · 0.45
HeaderMethod · 0.45
WriteHeaderMethod · 0.45

Tested by

no test coverage detected