diff --git a/pyinfra/visitor/response_formatter/formatter.py b/pyinfra/visitor/response_formatter/formatter.py index 589defc..ebb4832 100644 --- a/pyinfra/visitor/response_formatter/formatter.py +++ b/pyinfra/visitor/response_formatter/formatter.py @@ -1,9 +1,13 @@ import abc +from funcy import identity + +from pyinfra.utils.func import lift + class ResponseFormatter(abc.ABC): def __call__(self, message): - return map(self.format, message) + return (identity if isinstance(message, dict) else lift)(self.format)(message) @abc.abstractmethod def format(self, message):