diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-08-18 10:34:22 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-08-27 16:25:44 -0400 |
commit | f5ff2961d589623d1dd96faba82b9f86b620cdd0 (patch) | |
tree | 316cd1c2545af9890c7f38c73056c1e160d2ddbc /apps/chttpd/src/chttpd_view.erl | |
parent | 81121469814e363988c650992759e21f04271ae8 (diff) |
return well-formed response for reduce view with 0 rows, BugzID 10725
Diffstat (limited to 'apps/chttpd/src/chttpd_view.erl')
-rw-r--r-- | apps/chttpd/src/chttpd_view.erl | 4 |
1 files changed, 4 insertions, 0 deletions
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), |