cookies get key hotfix (#1076)
Co-authored-by: peterstone2017 <yunchuwang5@gmail.com>
This commit is contained in:
Родитель
7afe38f6bf
Коммит
068fbf8cd2
|
@ -192,7 +192,7 @@ def datum_as_proto(datum: Datum) -> protos.TypedData:
|
||||||
k: v.value
|
k: v.value
|
||||||
for k, v in datum.value['headers'].items()
|
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,
|
enable_content_negotiation=False,
|
||||||
body=datum_as_proto(datum.value['body']),
|
body=datum_as_proto(datum.value['body']),
|
||||||
))
|
))
|
||||||
|
|
|
@ -9,7 +9,7 @@ from dateutil.parser import ParserError
|
||||||
from azure_functions_worker import protos
|
from azure_functions_worker import protos
|
||||||
from azure_functions_worker.bindings.datumdef import \
|
from azure_functions_worker.bindings.datumdef import \
|
||||||
parse_cookie_attr_expires, \
|
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 \
|
from azure_functions_worker.bindings.nullable_converters import \
|
||||||
to_nullable_bool, to_nullable_string, to_nullable_double, \
|
to_nullable_bool, to_nullable_string, to_nullable_double, \
|
||||||
to_nullable_timestamp
|
to_nullable_timestamp
|
||||||
|
@ -127,3 +127,16 @@ class TestDatumRef(unittest.TestCase):
|
||||||
rpc_cookies = parse_to_rpc_http_cookie_list([cookies])
|
rpc_cookies = parse_to_rpc_http_cookie_list([cookies])
|
||||||
self.assertEqual(cookie1, rpc_cookies[0])
|
self.assertEqual(cookie1, rpc_cookies[0])
|
||||||
self.assertEqual(cookie2, rpc_cookies[1])
|
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')))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче