From 2137b1e4b3fd147fc53a614cb1358bd3d50341bf Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Mon, 2 Jan 2023 11:30:40 -0600 Subject: Fix JSON HTTP 200 :) --- src/clog.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/clog.c') diff --git a/src/clog.c b/src/clog.c index 83f9f79..5c0037f 100644 --- a/src/clog.c +++ b/src/clog.c @@ -279,8 +279,6 @@ render_posts_json(struct post_request *post_req) { int err = 0; - int rows = 0; - const char *json = NULL; struct kore_pgsql sql; @@ -328,20 +326,19 @@ render_posts_json(struct post_request *post_req) goto out; } + // XXX Always tuples from the above Postgres queries, need to check the length for results. if (kore_pgsql_getlength(&sql, 0, 0) == 0) { post_req->resp_status = HTTP_STATUS_NOT_FOUND; goto out; } - if (rows == 1) { - json = kore_pgsql_getvalue(&sql, 0, 0); - kore_buf_append( - post_req->resp_buf, - json, - strlen(json) - ); - } + json = kore_pgsql_getvalue(&sql, 0, 0); + kore_buf_append( + post_req->resp_buf, + json, + strlen(json) + ); out: ; -- cgit v1.2.3