Skip to content

cookies get key hotfix #1076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure_functions_worker/bindings/datumdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
k: v.value
for k, v in datum.value['headers'].items()
},
cookies=parse_to_rpc_http_cookie_list(datum.value['cookies']),
cookies=parse_to_rpc_http_cookie_list(datum.value.get('cookies')),
enable_content_negotiation=False,
body=datum_as_proto(datum.value['body']),
))
Expand Down
15 changes: 14 additions & 1 deletion tests/unittests/test_datumref.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from azure_functions_worker import protos
from azure_functions_worker.bindings.datumdef import \
parse_cookie_attr_expires, \
parse_cookie_attr_same_site, parse_to_rpc_http_cookie_list
parse_cookie_attr_same_site, parse_to_rpc_http_cookie_list, Datum
from azure_functions_worker.bindings.nullable_converters import \
to_nullable_bool, to_nullable_string, to_nullable_double, \
to_nullable_timestamp
Expand Down Expand Up @@ -127,3 +127,16 @@ def test_parse_to_rpc_http_cookie_list_valid(self):
rpc_cookies = parse_to_rpc_http_cookie_list([cookies])
self.assertEqual(cookie1, rpc_cookies[0])
self.assertEqual(cookie2, rpc_cookies[1])

def test_parse_to_rpc_http_cookie_list_no_cookie(self):
datum = Datum(
type='http',
value=dict(
status_code=None,
headers=None,
body=None,
)
)

self.assertIsNone(
parse_to_rpc_http_cookie_list(datum.value.get('cookies')))