gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: add json response headers to rest plugin


From: gnunet
Subject: [gnunet] branch master updated: add json response headers to rest plugins
Date: Sat, 09 May 2020 21:00:09 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 63c92bbef add json response headers to rest plugins
63c92bbef is described below

commit 63c92bbef932b831de7741ecc45c21915bfda82a
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Sat May 9 20:55:08 2020 +0200

    add json response headers to rest plugins
---
 src/gns/plugin_rest_gns.c                | 2 ++
 src/identity/plugin_rest_identity.c      | 7 ++++---
 src/peerinfo-tool/plugin_rest_peerinfo.c | 2 ++
 src/rest/plugin_rest_config.c            | 1 +
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 81c2c974b..feb333350 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -200,6 +200,7 @@ do_error (void *cls)
     handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
   response = json_dumps (json_error, 0);
   resp = GNUNET_REST_create_response (response);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, handle->response_code);
   json_decref (json_error);
   GNUNET_free (response);
@@ -252,6 +253,7 @@ handle_gns_response (void *cls,
   result = json_dumps (result_obj, 0);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
   resp = GNUNET_REST_create_response (result);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result);
   json_decref (result_obj);
diff --git a/src/identity/plugin_rest_identity.c 
b/src/identity/plugin_rest_identity.c
index 4b3571996..97a7bf513 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -309,6 +309,7 @@ do_error (void *cls)
     handle->response_code = MHD_HTTP_OK;
   response = json_dumps (json_error, 0);
   resp = GNUNET_REST_create_response (response);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, handle->response_code);
   json_decref (json_error);
   GNUNET_free (response);
@@ -398,7 +399,7 @@ ego_get_for_subsystem (void *cls,
   result_str = json_dumps (json_root, 0);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
   resp = GNUNET_REST_create_response (result_str);
-
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   json_decref (json_root);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result_str);
@@ -485,7 +486,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
   result_str = json_dumps (json_root, 0);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
   resp = GNUNET_REST_create_response (result_str);
-
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   json_decref (json_root);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free (result_str);
@@ -518,7 +519,7 @@ ego_get_response (struct RequestHandle *handle, struct 
EgoEntry *ego_entry)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
   resp = GNUNET_REST_create_response (result_str);
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   json_decref (json_ego);
   GNUNET_free (result_str);
   GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c 
b/src/peerinfo-tool/plugin_rest_peerinfo.c
index 6e156569a..514b14313 100644
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ b/src/peerinfo-tool/plugin_rest_peerinfo.c
@@ -326,6 +326,7 @@ do_error (void *cls)
     handle->response_code = MHD_HTTP_OK;
   response = json_dumps (json_error, 0);
   resp = GNUNET_REST_create_response (response);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, handle->response_code);
   json_decref (json_error);
   GNUNET_free (response);
@@ -356,6 +357,7 @@ peerinfo_list_finished (void *cls)
   result_str = json_dumps (handle->response, 0);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
   resp = GNUNET_REST_create_response (result_str);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   GNUNET_free_non_null (result_str);
   GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c
index d89c858ee..43dea1b9f 100644
--- a/src/rest/plugin_rest_config.c
+++ b/src/rest/plugin_rest_config.c
@@ -175,6 +175,7 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle,
   }
   response = json_dumps (result, 0);
   resp = GNUNET_REST_create_response (response);
+  MHD_add_response_header (resp, "Content-Type", "application/json");
   handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
   cleanup_handle (handle);
   GNUNET_free (response);

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]