From 86437b9d2d141681e14cd48e38dc8d2c61f6a7d8 Mon Sep 17 00:00:00 2001 From: vivjd Date: Sat, 6 Jan 2024 12:45:25 -0500 Subject: [PATCH] fix: changed content-type to a valid attribute Signed-off-by: vivjd --- cloudevents/kafka/conversion.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudevents/kafka/conversion.py b/cloudevents/kafka/conversion.py index 832594d..c3e63de 100644 --- a/cloudevents/kafka/conversion.py +++ b/cloudevents/kafka/conversion.py @@ -87,10 +87,10 @@ def to_binary( ) headers = {} - if event["content-type"]: - headers["content-type"] = event["content-type"].encode("utf-8") + if event["datacontenttype"]: + headers["datacontenttype"] = event["datacontenttype"].encode("utf-8") for attr, value in event.get_attributes().items(): - if attr not in ["data", "partitionkey", "content-type"]: + if attr not in ["data", "partitionkey", "datacontenttype"]: if value is not None: headers["ce_{0}".format(attr)] = value.encode("utf-8") @@ -189,8 +189,8 @@ def to_structured( attrs["data"] = data headers = {} - if "content-type" in attrs: - headers["content-type"] = attrs.pop("content-type").encode("utf-8") + if "datacontenttype" in attrs: + headers["datacontenttype"] = attrs.pop("datacontenttype").encode("utf-8") try: value = envelope_marshaller(attrs)