summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-hreq.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index 35b90aac..8c5110d9 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -691,14 +691,10 @@ static void req_reply(struct afb_hreq *hreq, unsigned retcode, const char *statu
reply = afb_msg_json_reply(status, info, resp, token, uuid);
reqid = afb_hreq_get_argument(hreq, long_key_for_reqid);
- if (reqid != NULL && json_object_object_get_ex(reply, "request", &request)) {
- json_object_object_add (request, long_key_for_reqid, json_object_new_string(reqid));
- } else {
+ 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));
- }
- }
+ 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));
response = MHD_create_response_from_callback((uint64_t)strlen(json_object_to_json_string(reply)), SIZE_RESPONSE_BUFFER, (void*)send_json_cb, reply, (void*)json_object_put);
afb_hreq_reply(hreq, retcode, response, NULL);