From a3ea1255d671340668a0151c689e27dc49597fe3 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Wed, 4 Jun 2008 19:06:25 +0000 Subject: Use linebreaks between rows for view results with a negative count value, same as for a positive value. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@663345 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index d22ea2b1..81217a74 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -762,14 +762,14 @@ make_view_fold_fun(Req, QueryArgs, TotalViewCount, ReduceCountFun) -> Resp2 = start_json_response(Req, 200), Offset2 = TotalViewCount - Offset - lists:min([TotalViewCount - Offset, - AccCount]), - JsonBegin = io_lib:format("{\"total_rows\":~w,\"offset\":~w,\"rows\":[", + JsonBegin = io_lib:format("{\"total_rows\":~w,\"offset\":~w,\"rows\":[\r\n", [TotalViewCount, Offset2]), Resp2:write_chunk(lists:flatten(JsonBegin)), JsonObj = {obj, [{id, DocId}, {key, Key}, {value, Value}]}, {ok, {AccCount + 1, 0, Resp2, [cjson:encode(JsonObj) | AccRevRows]}}; {_, AccCount, _, Resp} -> JsonObj = {obj, [{id, DocId}, {key, Key}, {value, Value}]}, - {ok, {AccCount + 1, 0, Resp, [cjson:encode(JsonObj), "," | AccRevRows]}} + {ok, {AccCount + 1, 0, Resp, [cjson:encode(JsonObj), ",\r\n" | AccRevRows]}} end end, -- cgit v1.2.3