diff options
author | Jan Lehnardt <jan@apache.org> | 2010-02-05 01:13:28 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2010-02-05 01:13:28 +0000 |
commit | 15d10793a32a5fa57c80e9eab8803dc7d284ca6d (patch) | |
tree | af84bff66183ba71fda98cb1c53b97b720690fe2 /share/server | |
parent | ff1618779bc85d8f16d6aeebec461fad51b008c5 (diff) |
add list()-API cmompatible API to _show. Symmetry FTW.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@906755 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/server')
-rw-r--r-- | share/server/render.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/share/server/render.js b/share/server/render.js index 11c76373..1e341ec7 100644 --- a/share/server/render.js +++ b/share/server/render.js @@ -212,8 +212,20 @@ var Render = (function() { function runShow(fun, ddoc, args) { try { + resetList(); Mime.resetProvides(); - var resp = fun.apply(ddoc, args); + var resp = fun.apply(ddoc, args) || {}; + + // handle list() style API + if (chunks.length && chunks.length > 0) { + resp = maybeWrapResponse(resp); + resp.headers = resp.headers || {}; + for(var header in startResp) { + resp.headers[header] = startResp[header] + } + resp.body = chunks.join("") + (resp.body || ""); + resetList(); + } if (Mime.providesUsed) { resp = Mime.runProvides(args[1]); |