diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-06-08 10:13:17 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-06-08 11:49:58 +0200 |
commit | b57505f0f80f6394f04a041df6e808c857b01d4b (patch) | |
tree | 8f9d2abb6544d2a2be0890c2b959bcd680ab3a1b /src/afb-hreq.c | |
parent | cee4240979b3b9c4ebb877631e66157918598c3d (diff) |
Improves message formating
Change-Id: Ifde5ff73cd6a73715fd4d6fd58101d9e97a3bef4
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-hreq.c')
-rw-r--r-- | src/afb-hreq.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c index 5f9ca510..4ca8441e 100644 --- a/src/afb-hreq.c +++ b/src/afb-hreq.c @@ -774,20 +774,15 @@ static ssize_t send_json_cb(json_object *obj, uint64_t pos, char *buf, size_t ma static void req_reply(struct afb_hreq *hreq, unsigned retcode, const char *status, const char *info, json_object *resp) { - struct json_object *reply, *request; - const char *token, *uuid, *reqid; + struct json_object *reply; + const char *reqid; struct MHD_Response *response; - token = afb_context_sent_token(&hreq->context); - uuid = afb_context_sent_uuid(&hreq->context); - - reply = afb_msg_json_reply(status, info, resp, token, uuid); - reqid = afb_hreq_get_argument(hreq, long_key_for_reqid); if (reqid == NULL) reqid = afb_hreq_get_argument(hreq, short_key_for_reqid); - if (reqid != NULL && json_object_object_get_ex(reply, "request", &request)) - json_object_object_add (request, short_key_for_reqid, json_object_new_string(reqid)); + + reply = afb_msg_json_reply(status, info, resp, &hreq->context, reqid); response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string_ext(reply, JSON_C_TO_STRING_PLAIN)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put); afb_hreq_reply(hreq, retcode, response, NULL); |