From f5ff2961d589623d1dd96faba82b9f86b620cdd0 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 18 Aug 2010 10:34:22 -0400 Subject: return well-formed response for reduce view with 0 rows, BugzID 10725 --- apps/chttpd/src/chttpd_view.erl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/chttpd/src/chttpd_view.erl b/apps/chttpd/src/chttpd_view.erl index 87138702..6419e807 100644 --- a/apps/chttpd/src/chttpd_view.erl +++ b/apps/chttpd/src/chttpd_view.erl @@ -51,6 +51,10 @@ view_callback({row, Row}, {nil, Resp}) -> view_callback({row, Row}, {Prepend, Resp}) -> send_chunk(Resp, [Prepend, ?JSON_ENCODE(Row)]), {ok, {",\r\n", Resp}}; +view_callback(complete, {nil, Resp}) -> + send_chunk(Resp, "{\"rows\":[]}"), + end_json_response(Resp), + {ok, Resp}; view_callback(complete, {_, Resp}) -> send_chunk(Resp, "\r\n]}"), end_json_response(Resp), -- cgit v1.2.3