mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-03-25 13:28:32 +00:00
handles verification request correctly
This commit is contained in:
parent
193778dec0
commit
5c83578524
@ -205,8 +205,9 @@ class MqttNotificationHandler(BaseNotificationHandler):
|
||||
from openmtc_onem2m.exc import get_response_status
|
||||
|
||||
def wrapper(request):
|
||||
notification = self._unpack_notification(request.content)
|
||||
self._callback(request.originator, **notification)
|
||||
if not request.content.verificationRequest:
|
||||
notification = self._unpack_notification(request.content)
|
||||
self._callback(request.originator, **notification)
|
||||
return OneM2MResponse(status_code=get_response_status(2000), request=request)
|
||||
|
||||
self._client = get_client(self._endpoint.geturl(), handle_request_func=wrapper)
|
||||
@ -256,8 +257,9 @@ class HttpNotificationHandler(BaseNotificationHandler):
|
||||
assert 'content-type' in request.headers, 'Unspecified content type'
|
||||
|
||||
notification = get_onem2m_decoder(request.content_type).decode(request.data)
|
||||
notification = self._unpack_notification(notification)
|
||||
self._callback(request.headers['x-m2m-origin'], **notification)
|
||||
if not notification.verificationRequest:
|
||||
notification = self._unpack_notification(notification)
|
||||
self._callback(request.headers['x-m2m-origin'], **notification)
|
||||
|
||||
return Response(
|
||||
headers={
|
||||
|
Loading…
x
Reference in New Issue
Block a user