Skip to content

Commit a5fc827

Browse files
authored
ignore datacontenttype when using to_binary() (#138)
* ignore datacontenttype when using to_binary() Signed-off-by: XinYang <[email protected]> * fix tests Signed-off-by: XinYang <[email protected]> * fix tests. sanic>20.12 does not support py3.6 any more Signed-off-by: XinYang <[email protected]>
1 parent b83bfc5 commit a5fc827

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cloudevents/sdk/event/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def MarshalBinary(
292292
headers["content-type"] = self.ContentType()
293293
props = self.Properties()
294294
for key, value in props.items():
295-
if key not in ["data", "extensions", "contenttype"]:
295+
if key not in ["data", "extensions", "datacontenttype"]:
296296
if value is not None:
297297
headers["ce-{0}".format(key)] = value
298298

cloudevents/tests/test_with_sanic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def echo(request):
3434
v1.Event(), dict(request.headers), request.body, lambda x: x
3535
)
3636
hs, body = m.ToRequest(event, converters.TypeBinary, lambda x: x)
37-
return response.text(body, headers=hs)
37+
return response.text(body.decode("utf-8"), headers=hs)
3838

3939

4040
def test_reusable_marshaller():

requirements/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ flake8-strict
66
pytest==4.0.0
77
pytest-cov==2.4.0
88
# web app tests
9-
sanic
9+
sanic==20.12.3
1010
aiohttp
1111
Pillow
1212
requests

0 commit comments

Comments
 (0)