File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from nitric .proto .topics .v1 import ClientMessage as TopicClientMessage
3232from nitric .proto .topics .v1 import MessageResponse as TopicResponse
3333from nitric .proto .topics .v1 import ServerMessage as TopicServerMessage
34+ from nitric .utils import dict_from_struct
3435
3536Record = Dict [str , Union [str , List [str ]]]
3637PROPAGATOR = propagate .get_global_textmap ()
@@ -173,7 +174,7 @@ def _from_request(msg: TopicServerMessage) -> MessageContext:
173174 """Construct a new EventContext from a Topic trigger from the Nitric Membrane."""
174175 return MessageContext (
175176 request = MessageRequest (
176- data = msg .message_request .message .struct_payload . to_dict ( ),
177+ data = dict_from_struct ( msg .message_request .message .struct_payload ),
177178 topic = msg .message_request .topic_name ,
178179 )
179180 )
Original file line number Diff line number Diff line change 3737from nitric .proto .topics .v1 import RegistrationRequest , SubscriberStub
3838from nitric .proto .topics .v1 import TopicPublishRequest , TopicsStub
3939from nitric .resources .resource import SecureResource
40- from nitric .utils import new_default_channel , struct_from_dict
40+ from nitric .utils import dict_from_struct , new_default_channel , struct_from_dict
4141
4242TopicPermission = Literal ["publish" ]
4343
@@ -131,7 +131,7 @@ def decorator(func: EventHandler) -> None:
131131def _message_context_from_proto (msg : ProtoMessageRequest ) -> MessageContext :
132132 return MessageContext (
133133 request = MessageRequest (
134- data = msg .message .struct_payload . to_dict ( ),
134+ data = dict_from_struct ( msg .message .struct_payload ),
135135 topic = msg .topic_name ,
136136 )
137137 )
You can’t perform that action at this time.
0 commit comments