handles verification request correctly

This commit is contained in:
Ronald Steinke 2018-10-05 11:44:13 +02:00
parent 193778dec0
commit 5c83578524

View File

@ -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={