WriteJSONResponse writes some JSON as a HTTP response.
(w http.ResponseWriter, v any)
| 192 | |
| 193 | // WriteJSONResponse writes some JSON as a HTTP response. |
| 194 | func writeJSONResponse(w http.ResponseWriter, v any) { |
| 195 | w.Header().Set("Content-Type", "application/json") |
| 196 | |
| 197 | if err := json.NewEncoder(w).Encode(v); err != nil { |
| 198 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 199 | } |
| 200 | } |
no test coverage detected