From 9b83ec394c830ce4f01fa693179c01826859b6e0 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 24 Jan 2009 05:17:50 +0000 Subject: Improve show/list API and send external responses without chunked as it's not needed. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@737304 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch_tests.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'share/www/script/couch_tests.js') diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index 9fea3be7..c87e01a5 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -2610,19 +2610,21 @@ var tests = { acceptSwitch: stringFun(function(head, row, req) { return respondWith(req, { html : function() { + // If you're outputting text and you're not setting + // any headers, you can just return a string. if (head) { - return {body : "HTML "; } }, xml : function() { if (head) { - return {body:'' - +'Test XML Feed'}; + return '' + +'Test XML Feed'; } else if (row) { // Becase Safari can't stand to see that dastardly // E4X outside of a string. Outside of tests you @@ -2631,9 +2633,11 @@ var tests = { entry.id = row.id; entry.title = row.key; entry.content = row.value; - return {body:entry}; + // We'll also let you return just an E4X object + // if you aren't setting headers. + return entry; } else { - return {body : ""}; + return ""; } } }) -- cgit v1.2.3