Skip to content

Commit b49b2d4

Browse files
author
peterstone2017
committed
cookies get key hotfix
1 parent 7afe38f commit b49b2d4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

azure_functions_worker/bindings/datumdef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
192192
k: v.value
193193
for k, v in datum.value['headers'].items()
194194
},
195-
cookies=parse_to_rpc_http_cookie_list(datum.value['cookies']),
195+
cookies=parse_to_rpc_http_cookie_list(datum.value.get('cookies')),
196196
enable_content_negotiation=False,
197197
body=datum_as_proto(datum.value['body']),
198198
))

tests/unittests/test_datumref.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from azure_functions_worker import protos
1010
from azure_functions_worker.bindings.datumdef import \
1111
parse_cookie_attr_expires, \
12-
parse_cookie_attr_same_site, parse_to_rpc_http_cookie_list
12+
parse_cookie_attr_same_site, parse_to_rpc_http_cookie_list, Datum
1313
from azure_functions_worker.bindings.nullable_converters import \
1414
to_nullable_bool, to_nullable_string, to_nullable_double, \
1515
to_nullable_timestamp
@@ -127,3 +127,16 @@ def test_parse_to_rpc_http_cookie_list_valid(self):
127127
rpc_cookies = parse_to_rpc_http_cookie_list([cookies])
128128
self.assertEqual(cookie1, rpc_cookies[0])
129129
self.assertEqual(cookie2, rpc_cookies[1])
130+
131+
def test_parse_to_rpc_http_cookie_list_no_cookie(self):
132+
datum = Datum(
133+
type='http',
134+
value=dict(
135+
status_code=None,
136+
headers=None,
137+
body=None,
138+
)
139+
)
140+
141+
self.assertIsNone(
142+
parse_to_rpc_http_cookie_list(datum.value.get('cookies')))

0 commit comments

Comments
 (0)