Skip to content

Commit 59614a3

Browse files
committed
fix: changed content-type to a valid attribute
Signed-off-by: vivjd <[email protected]>
1 parent 21572af commit 59614a3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cloudevents/kafka/conversion.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ def to_binary(
8787
)
8888

8989
headers = {}
90-
if event["content-type"]:
91-
headers["content-type"] = event["content-type"].encode("utf-8")
90+
if event["datacontenttype"]:
91+
headers["datacontenttype"] = event["datacontenttype"].encode("utf-8")
9292
for attr, value in event.get_attributes().items():
93-
if attr not in ["data", "partitionkey", "content-type"]:
93+
if attr not in ["data", "partitionkey", "datacontenttype"]:
9494
if value is not None:
9595
headers["ce_{0}".format(attr)] = value.encode("utf-8")
9696

@@ -189,8 +189,8 @@ def to_structured(
189189
attrs["data"] = data
190190

191191
headers = {}
192-
if "content-type" in attrs:
193-
headers["content-type"] = attrs.pop("content-type").encode("utf-8")
192+
if "datacontenttype" in attrs:
193+
headers["datacontenttype"] = attrs.pop("datacontenttype").encode("utf-8")
194194

195195
try:
196196
value = envelope_marshaller(attrs)

0 commit comments

Comments
 (0)