static const char _mode_[] = "mode";
static const char _local_[] = "local";
static const char _remote_[]= "remote";
+static const char _auto_[] = "auto";
static const char _uri_[] = "uri";
static struct jbus *jbus;
return result;
}
-static struct json_object *call(AFB_request *request, AFB_PostItem *item, const char *tag, struct json_object *(*fun)(AFB_request*,AFB_PostItem*))
-{
- return embed(request, tag, fun(request, item));
-}
-
static struct json_object *call_void(AFB_request *request, AFB_PostItem *item)
{
struct json_object *obj = jbus_call_sj_sync(jbus, request->api, "true");
}
/* get the mode */
mode = getQueryValue(request, _mode_);
- if (mode == NULL) {
+ if (mode == NULL || !strcmp(mode, _auto_)) {
mode = request->config->mode == AFB_MODE_REMOTE ? _remote_ : _local_;
}
free(query);
/* embed if needed */
- if (json_object_get_type(resp) == json_type_string)
+ if (json_object_get_type(resp) == json_type_int)
resp = embed(request, _runid_, resp);
request->errcode = resp ? MHD_HTTP_OK : MHD_HTTP_FAILED_DEPENDENCY;
return resp;