We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7437ea4 commit c704120Copy full SHA for c704120
cloudevents/sdk/http/event.py
@@ -24,7 +24,7 @@
24
25
26
def default_marshaller(content: any):
27
- if len(content) == 0:
+ if content is None or len(content) == 0:
28
return None
29
try:
30
return json.dumps(content)
cloudevents/tests/test_http_events.py
@@ -401,3 +401,16 @@ def test_cloudevent_repr(specversion):
401
# we had issues in the past where event.__repr__() could run but
402
# print(event) would fail.
403
print(event)
404
+
405
406
+@pytest.mark.parametrize("specversion", ["1.0", "0.3"])
407
+def test_none_data_cloudevent(specversion):
408
+ event = CloudEvent(
409
+ {
410
+ "source": "<my-url>",
411
+ "type": "issue.example",
412
+ "specversion": specversion,
413
+ }
414
+ )
415
+ to_binary_http(event)
416
+ to_structured_http(event)
0 commit comments