Bladeren bron

Automatically add the VTN ID to messages
Closes #5.

Stan Janssen 4 jaren geleden
bovenliggende
commit
61b7bf5994
1 gewijzigde bestanden met toevoegingen van 2 en 1 verwijderingen
  1. 2 1
      pyopenadr/service/vtn_service.py

+ 2 - 1
pyopenadr/service/vtn_service.py

@@ -34,12 +34,13 @@ class VTNService:
         if message_type in self.handlers:
             handler = self.handlers[message_type]
             response_type, response_payload = await handler(message_payload)
+            response_payload['vtn_id'] = self.vtn_id
 
             # Get the relevant template and create the XML response
             template = self.templates.get_template(f'{response_type}.xml')
             template.render(**response_payload)
             response = web.Response(text=indent_xml(template.render(**response_payload)),
-                                    status=200,
+                                    status=HTTPStatus.OK,
                                     content_type='application/xml')
 
         else: