summaryrefslogtreecommitdiff
path: root/fw/app/src/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/app/src/http.c')
-rw-r--r--fw/app/src/http.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fw/app/src/http.c b/fw/app/src/http.c
index 081629b..83a3568 100644
--- a/fw/app/src/http.c
+++ b/fw/app/src/http.c
@@ -13,6 +13,7 @@
#include <zephyr/net/http/service.h>
#include <zephyr/net/http/status.h>
+#include "settings.h"
#include "ws.h"
@@ -98,9 +99,16 @@ static int settings_handler(
struct http_response_ctx *response_ctx,
void *user_data
) {
- static const char dummy[] = "{\"syslog\":{\"target\":{\"ip\":\"fe80::1\"}}}\n";
- response_ctx->body = (const uint8_t *)dummy;
- response_ctx->body_len = sizeof(dummy) - 1;
+ static char buffer[100];
+
+ int ret = settings_to_json(buffer, sizeof(buffer));
+ if (ret < 0) {
+ LOG_ERR("Could not serialize payload for settings request");
+ return ret;
+ }
+
+ response_ctx->body = (const uint8_t *)buffer;
+ response_ctx->body_len = ret;
response_ctx->final_chunk = true;
response_ctx->status = HTTP_200_OK;