package utility import ( "encoding/json" "net/http" "github.com/eagleusb/proxycon/internal/types" ) // WriteJSONError writes a JSON-formatted error response for consistency. func WriteJSONError(w http.ResponseWriter, message string, code int) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(code) json.NewEncoder(w).Encode(types.ErrorResponse{Code: code, Message: message}) }