From 2d224ee5fc95fd0bc2eaeb0c446afd784b2a1d0b Mon Sep 17 00:00:00 2001 From: andreaimprovised <1066590+andreaimprovised@users.noreply.github.com> Date: Mon, 20 May 2024 22:13:06 -0700 Subject: [PATCH] fix: when headers() returns None in AsyncConfluentParser, replace it with an empty tuple (#1460) --- faststream/confluent/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faststream/confluent/parser.py b/faststream/confluent/parser.py index e743c96e6b..a093a16da7 100644 --- a/faststream/confluent/parser.py +++ b/faststream/confluent/parser.py @@ -20,7 +20,7 @@ async def parse_message( message: "Message", ) -> "StreamMessage[Message]": """Parses a Kafka message.""" - headers = _parse_msg_headers(message.headers()) + headers = _parse_msg_headers(message.headers() or ()) body = message.value() offset = message.offset() @@ -53,7 +53,7 @@ async def parse_message_batch( for m in message: body.append(m.value()) - batch_headers.append(_parse_msg_headers(m.headers())) + batch_headers.append(_parse_msg_headers(m.headers() or ())) headers = next(iter(batch_headers), {})