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

Function respondWithJSON

socks/connection_handler_test.go:64–70  ·  view source on GitHub ↗
(w http.ResponseWriter, v interface{}, status int)

Source from the content-addressed store, hash-verified

62}
63
64func respondWithJSON(w http.ResponseWriter, v interface{}, status int) {
65 data, _ := json.Marshal(v)
66
67 w.Header().Set("Content-Type", "application/json")
68 w.WriteHeader(status)
69 w.Write(data)
70}
71
72func OkJSONResponseHandler(w http.ResponseWriter, r *http.Request) {
73 resp := successResponse{

Callers 1

OkJSONResponseHandlerFunction · 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