renderJSON renders 'v' as JSON and writes it as a response into w.
(w http.ResponseWriter, v any)
| 31 | |
| 32 | // renderJSON renders 'v' as JSON and writes it as a response into w. |
| 33 | func renderJSON(w http.ResponseWriter, v any) { |
| 34 | js, err := json.Marshal(v) |
| 35 | if err != nil { |
| 36 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 37 | return |
| 38 | } |
| 39 | w.Header().Set("Content-Type", "application/json") |
| 40 | w.Write(js) |
| 41 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…