param imanagement wip
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-19 23:04:50 +01:00
parent 29fb5f456d
commit d0646de38a
3 changed files with 37 additions and 24 deletions

View File

@@ -31,9 +31,8 @@
#define ksuccess_post_body "{\"status\":\"post\"}"
#define kerror_body "{\"status\":\"error\"}"
#define ksuccess_put_param1 "{\"id\":\"1\"}"
#define ksuccess_put_param2 "{\"id\":\"1977\",\"action\":\"todo\"}"
#define ksuccess_put_param1 "{ \"id\": 1 }"
#define ksuccess_put_param2 "{ \"id\":\"1977\",\"action\":\"todo\" }"
#define kserver_port "7777"
#define kapi_test_get "/api/v1/test_get"
@@ -98,11 +97,11 @@ int my_success_rest_put_param_handler(restd_resp_t *response, void *arg)
struct json_object *root_node;
root_node = json_object_new_object();
if (response->has_parameter)
if (response->has_parameter == true)
{
if ((response->parameter_value != NULL) && (response->parameter_name != NULL))
if (response->parameter_name != NULL)
{
json_object_object_add(root_node, response->parameter_name, json_object_new_string(response->parameter_value));
json_object_object_add(root_node, response->parameter_name, json_object_new_int(response->parameter_value));
}
if (response->action != NULL)
{
@@ -202,7 +201,7 @@ int exec_request(const char *request, const char *path, int expected_code, const
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 2);
// Debug Only
//curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
// curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
/* send all data to this function */
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);