Skip to content

Commit 3ab30f7

Browse files
committed
feedback
1 parent 450b43e commit 3ab30f7

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

azure_functions_worker/dispatcher.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
PYTHON_LANGUAGE_RUNTIME, PYTHON_ENABLE_INIT_INDEXING,
3333
METADATA_PROPERTIES_WORKER_INDEXED)
3434
from .extension import ExtensionManager
35-
from .http_v2 import http_coordinator, initialize_http_server, HttpV2Registry
35+
from .http_v2 import http_coordinator, initialize_http_server, HttpV2Registry, \
36+
sync_http_request
3637
from .logging import disable_console_logging, enable_console_logging
3738
from .logging import (logger, error_logger, is_system_log_category,
3839
CONSOLE_LOG_PREFIX, format_exception)
@@ -549,13 +550,7 @@ async def _handle__invocation_request(self, request):
549550
http_request = await http_coordinator.get_http_request_async(
550551
invocation_id)
551552

552-
route_params = {key: item.string for key, item
553-
in invoc_request.trigger_metadata.items()
554-
if key not in ['Headers', 'Query']}
555-
556-
(HttpV2Registry.ext_base().RequestTrackerMeta
557-
.get_synchronizer()
558-
.sync_route_params(http_request, route_params))
553+
await sync_http_request(http_request, invoc_request)
559554
args[fi.trigger_metadata.get('param_name')] = http_request
560555

561556
fi_context = self._get_context(invoc_request, fi.name,

azure_functions_worker/functions.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,7 @@ def add_func_to_registry_and_return_funcinfo(self, function,
302302
str, ParamTypeInfo],
303303
return_type: str):
304304

305-
http_trigger_param_name = next(
306-
(input_type for input_type, type_info in input_types.items()
307-
if type_info.binding_name == HTTP_TRIGGER),
308-
None
309-
)
305+
http_trigger_param_name = self._get_http_trigger_param_name(input_types)
310306

311307
trigger_metadata = None
312308
is_http_func = False
@@ -335,6 +331,14 @@ def add_func_to_registry_and_return_funcinfo(self, function,
335331

336332
return function_info
337333

334+
def _get_http_trigger_param_name(self, input_types):
335+
http_trigger_param_name = next(
336+
(input_type for input_type, type_info in input_types.items()
337+
if type_info.binding_name == HTTP_TRIGGER),
338+
None
339+
)
340+
return http_trigger_param_name
341+
338342
def add_function(self, function_id: str,
339343
func: typing.Callable,
340344
metadata: protos.RpcFunctionMetadata):

azure_functions_worker/http_v2.py

+10
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ async def catch_all(request: request_type): # type: ignore
208208
return web_server_address
209209

210210

211+
async def sync_http_request(http_request, invoc_request):
212+
# Sync http request route params from invoc_request to http_request
213+
route_params = {key: item.string for key, item
214+
in invoc_request.trigger_metadata.items()
215+
if key not in ['Headers', 'Query']}
216+
(HttpV2Registry.ext_base().RequestTrackerMeta
217+
.get_synchronizer()
218+
.sync_route_params(http_request, route_params))
219+
220+
211221
class HttpV2Registry:
212222
_http_v2_enabled = False
213223
_ext_base = None

0 commit comments

Comments
 (0)