summaryrefslogtreecommitdiffstats
path: root/src/afb-msg-json.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-06-09 16:59:19 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-06-09 16:59:19 +0200
commit6518887513840471ea9c5af7e534787717e6bd82 (patch)
tree6aa4d2f8e777f25d318348a91d2c02ca62298b6b /src/afb-msg-json.c
parent741d4e0505c588f38a64350c1d3c53c74f7ac22c (diff)
Make possible to call a method from a binding
The new request call 'afb_req_subcall' allows a binding to call the method of an other binding. Change-Id: I8538185be7a1663153a25db2bc940f9e2bdedb1a Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-msg-json.c')
-rw-r--r--src/afb-msg-json.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/afb-msg-json.c b/src/afb-msg-json.c
index d5f6f5a5..8f543ff1 100644
--- a/src/afb-msg-json.c
+++ b/src/afb-msg-json.c
@@ -47,13 +47,15 @@ struct json_object *afb_msg_json_reply(const char *status, const char *info, str
if (reqid != NULL)
json_object_object_add(request, "reqid", json_object_new_string(reqid));
- token = afb_context_sent_token(context);
- if (token != NULL)
- json_object_object_add(request, "token", json_object_new_string(token));
-
- uuid = afb_context_sent_uuid(context);
- if (uuid != NULL)
- json_object_object_add(request, "uuid", json_object_new_string(uuid));
+ if (context != NULL) {
+ token = afb_context_sent_token(context);
+ if (token != NULL)
+ json_object_object_add(request, "token", json_object_new_string(token));
+
+ uuid = afb_context_sent_uuid(context);
+ if (uuid != NULL)
+ json_object_object_add(request, "uuid", json_object_new_string(uuid));
+ }
return msg;
}