|
31 | 31 |
|
32 | 32 | async def _register_faas_worker( |
33 | 33 | func: Callable[ |
34 | | - [Trigger], Union[Coroutine[Any, Any, Union[Response, None, dict, bytes]], Union[Response, None, dict, bytes]] |
| 34 | + [Trigger], |
| 35 | + Union[ |
| 36 | + Coroutine[Any, Any, Union[Response, None, dict, list, set, bytes]], |
| 37 | + Union[Response, None, dict, list, set, bytes], |
| 38 | + ], |
35 | 39 | ] |
36 | 40 | ): |
37 | 41 | """ |
@@ -74,7 +78,7 @@ async def _register_faas_worker( |
74 | 78 | if isinstance(response, bytes): |
75 | 79 | full_response.data = response |
76 | 80 | # convert dict responses to JSON |
77 | | - elif isinstance(response, dict): |
| 81 | + elif isinstance(response, (dict, list, set)): |
78 | 82 | full_response.data = bytes(json.dumps(response), "utf-8") |
79 | 83 | if full_response.context.is_http(): |
80 | 84 | full_response.context.as_http().headers["Content-Type"] = "application/json" |
@@ -106,7 +110,7 @@ async def _register_faas_worker( |
106 | 110 | channel.close() |
107 | 111 |
|
108 | 112 |
|
109 | | -def start(handler: Callable[[Trigger], Coroutine[Any, Any, Union[Response, None, dict, bytes]]]): |
| 113 | +def start(handler: Callable[[Trigger], Coroutine[Any, Any, Union[Response, None, dict, list, set, bytes]]]): |
110 | 114 | """ |
111 | 115 | Register the provided function as the trigger handler and starts handling new trigger requests. |
112 | 116 |
|
|
0 commit comments