diff scid/pageutil.c @ 50:b474f0985e39

scictl: add API key support
author David Demelier <markand@malikania.fr>
date Wed, 17 Aug 2022 09:11:58 +0200
parents 16f1c72d1635
children 71cd8447e3a4
line wrap: on
line diff
--- a/scid/pageutil.c	Wed Aug 17 09:11:44 2022 +0200
+++ b/scid/pageutil.c	Wed Aug 17 09:11:58 2022 +0200
@@ -19,8 +19,9 @@
 #include <assert.h>
 
 #include "pageutil.h"
+#include "scid.h"
 #include "theme.h"
-#include "scid.h"
+#include "util.h"
 
 void
 pageutil_render(struct kreq *req,
@@ -82,13 +83,11 @@
 
 	khttp_head(req, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[KMIME_APP_JSON]);
 	khttp_head(req, kresps[KRESP_STATUS], "%s", khttps[status]);
+	khttp_body(req);
 
 	if (doc) {
-		if ((body = json_dumps(doc, JSON_COMPACT))) {
-			khttp_body(req);
-			khttp_printf(req, "%s", body);
-		}
-
+		body = util_json_dump(doc);
+		khttp_printf(req, "%s", body);
 		json_decref(doc);
 	}