Fix callback issue which there is no payload in case of error message.
authorjihwan.seo <jihwan.seo@samsung.com>
Fri, 10 Feb 2017 04:24:24 +0000 (13:24 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 13 Feb 2017 10:41:45 +0000 (10:41 +0000)
check logic what payload is parsed was modified in
https://gerrit.iotivity.org/gerrit/#/c/15197/.
However that change cause some issue which
there is no payload in case of error message
with general get/put/post/delete message except for oic/res.

payload should be set in common in OCHandleResponse method.

Change-Id: I0c415022e35573ae76e730d9973206d218f18174
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17165
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/stack/src/ocstack.c

index 6bb5d27..3cdaecb 100644 (file)
@@ -1503,8 +1503,9 @@ void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* resp
                     OICFree(response);
                     return;
                 }
+
                 // In case of error, still want application to receive the error message.
-                if (OCResultToSuccess(response->result))
+                if (OCResultToSuccess(response->result) || PAYLOAD_TYPE_REPRESENTATION == type)
                 {
                     if (OC_STACK_OK != OCParsePayload(&response->payload,
                             type,