writeJSON writes a JSON response with the given status code. Used for success responses and legacy error responses during migration.
(w http.ResponseWriter, status int, data any)
| 40 | // writeJSON writes a JSON response with the given status code. |
| 41 | // Used for success responses and legacy error responses during migration. |
| 42 | func writeJSON(w http.ResponseWriter, status int, data any) { |
| 43 | w.Header().Set("Content-Type", "application/json") |
| 44 | w.WriteHeader(status) |
| 45 | json.NewEncoder(w).Encode(data) |
| 46 | } |
no test coverage detected