summaryrefslogtreecommitdiffstats
path: root/web/api/web_api_v1.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/web_api_v1.c')
-rw-r--r--web/api/web_api_v1.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c
index ccb1339927..fd111dc40d 100644
--- a/web/api/web_api_v1.c
+++ b/web/api/web_api_v1.c
@@ -793,13 +793,8 @@ inline void host_labels2json(RRDHOST *host, BUFFER *wb, size_t indentation) {
rrdhost_unlock(host);
}
-inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, char *url) {
- (void)url;
- if (!netdata_ready) return HTTP_RESP_BACKEND_FETCH_FAILED;
- BUFFER *wb = w->response.data;
- buffer_flush(wb);
- wb->contenttype = CT_APPLICATION_JSON;
-
+inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb)
+{
buffer_strcat(wb, "{\n");
buffer_sprintf(wb, "\t\"version\": \"%s\",\n", host->program_version);
buffer_sprintf(wb, "\t\"uid\": \"%s\",\n", host->machine_guid);
@@ -849,6 +844,18 @@ inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, c
buffer_strcat(wb, "\n\t]\n");
buffer_strcat(wb, "}");
+ return 0;
+}
+
+inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, char *url) {
+ (void)url;
+ if (!netdata_ready) return HTTP_RESP_BACKEND_FETCH_FAILED;
+ BUFFER *wb = w->response.data;
+ buffer_flush(wb);
+ wb->contenttype = CT_APPLICATION_JSON;
+
+ web_client_api_request_v1_info_fill_buffer(host, wb);
+
buffer_no_cacheable(wb);
return HTTP_RESP_OK;
}