(w http.ResponseWriter, status int, v any)
| 19 | } |
| 20 | |
| 21 | func writeJSON(w http.ResponseWriter, status int, v any) { |
| 22 | w.Header().Set("Content-Type", "application/json") |
| 23 | w.WriteHeader(status) |
| 24 | if err := json.NewEncoder(w).Encode(v); err != nil { |
| 25 | mudlog.Error("API", "action", "writeJSON", "error", err) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func writeAPIError(w http.ResponseWriter, status int, message string) { |
| 30 | writeJSON(w, status, APIResponse[struct{}]{ |
no test coverage detected