From 08ca42769465552fc2d2adf15af617a9a5426786 Mon Sep 17 00:00:00 2001 From: Xin Yang Date: Tue, 25 May 2021 18:12:02 +0800 Subject: [PATCH 1/3] ignore datacontenttype when using to_binary() Signed-off-by: XinYang --- cloudevents/sdk/event/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudevents/sdk/event/base.py b/cloudevents/sdk/event/base.py index 7dc5d729..c0929464 100644 --- a/cloudevents/sdk/event/base.py +++ b/cloudevents/sdk/event/base.py @@ -292,7 +292,7 @@ def MarshalBinary( headers["content-type"] = self.ContentType() props = self.Properties() for key, value in props.items(): - if key not in ["data", "extensions", "contenttype"]: + if key not in ["data", "extensions", "datacontenttype"]: if value is not None: headers["ce-{0}".format(key)] = value From 4b0122222596223caa62e73e8d0af2dd21714244 Mon Sep 17 00:00:00 2001 From: XinYang Date: Fri, 28 May 2021 00:30:11 +0800 Subject: [PATCH 2/3] fix tests Signed-off-by: XinYang --- cloudevents/tests/test_with_sanic.py | 2 +- requirements/test.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudevents/tests/test_with_sanic.py b/cloudevents/tests/test_with_sanic.py index 135bfd5c..e02f650c 100644 --- a/cloudevents/tests/test_with_sanic.py +++ b/cloudevents/tests/test_with_sanic.py @@ -34,7 +34,7 @@ async def echo(request): v1.Event(), dict(request.headers), request.body, lambda x: x ) hs, body = m.ToRequest(event, converters.TypeBinary, lambda x: x) - return response.text(body, headers=hs) + return response.text(body.decode("utf-8"), headers=hs) def test_reusable_marshaller(): diff --git a/requirements/test.txt b/requirements/test.txt index 6aa95bdb..443ba339 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -7,6 +7,7 @@ pytest==4.0.0 pytest-cov==2.4.0 # web app tests sanic +sanic_testing aiohttp Pillow requests From 4b2ead0365248de3b0180503f72c6c8f00cc7c32 Mon Sep 17 00:00:00 2001 From: XinYang Date: Fri, 28 May 2021 09:08:55 +0800 Subject: [PATCH 3/3] fix tests. sanic>20.12 does not support py3.6 any more Signed-off-by: XinYang --- requirements/test.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index 443ba339..d4cf81e9 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -6,8 +6,7 @@ flake8-strict pytest==4.0.0 pytest-cov==2.4.0 # web app tests -sanic -sanic_testing +sanic==20.12.3 aiohttp Pillow requests