(w http.ResponseWriter, status int, message string)
| 480 | } |
| 481 | |
| 482 | func writeError(w http.ResponseWriter, status int, message string) { |
| 483 | w.Header().Set("Content-Type", "application/json") |
| 484 | w.WriteHeader(status) |
| 485 | _ = json.NewEncoder(w).Encode(map[string]any{"error": message}) |
| 486 | } |
| 487 | |
| 488 | func methodNotAllowed(w http.ResponseWriter) { |
| 489 | writeError(w, http.StatusMethodNotAllowed, "method not allowed") |
no test coverage detected