Fixed response payload to match the new specification (#8420)
* * Modify the payload object to include a code and body object * * Encoding body as a string * * Send the response as a string as specified in the doc
Stelios Fragkakis committed
Mar 19, 2020 at 14:38 UTC
8fb94cecf861aa3740f7ce3f085e07803887f260
1 file changed
+6
-4
aclk/agent_cloud_link.c
+6
-4
@@ -757,10 +757,12 @@ int aclk_execute_query(struct aclk_query *this_query)
757
758
aclk_create_header(local_buffer, "http", this_query->msg_id);
759
760
- if (rc != HTTP_RESP_OK || strcmp(mysep ? mysep + 1 : "noop", "badge.svg") == 0)
761
- buffer_sprintf(local_buffer, "\"%s\"", aclk_encode_response(w->response.data)->buffer);
762
- else
763
- buffer_sprintf(local_buffer, "%s", aclk_encode_response(w->response.data)->buffer);
760
+ //if (rc != HTTP_RESP_OK || strcmp(mysep ? mysep + 1 : "noop", "badge.svg") == 0)
761
+ buffer_sprintf(
762
+ local_buffer, "{\n\"code\": %d,\n\"body\": \"%s\"\n}", rc, aclk_encode_response(w->response.data)->buffer);
763
+ //else
764
+ // buffer_sprintf(local_buffer, "{\n\"code\": %d,\n\"body\": %s\n}", rc,
765
+ // aclk_encode_response(w->response.data)->buffer);
766
767
buffer_sprintf(local_buffer, "\n}");
768