You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Robert Sosinski <em...@robertsosinski.com> on 2010/11/03 04:22:38 UTC
Setting ContentType For List Functions
I have the following list function:
function(head, req) {
send("<ul>");
while(row = getRow()) {
send("<li>"+row.value.name+"</li>");
}
send("</ul>");
}
This function works except that it is being sent back with a ContentType of
"application/json". Is there any way to change the content type to
"text/html", similar to show functions?
Thanks,
-Robert
Re: Setting ContentType For List Functions
Posted by Robert Newson <ro...@gmail.com>.
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Specifying_Content-Type_Response_Header
On Wed, Nov 3, 2010 at 1:24 AM, David Rose <do...@gmail.com> wrote:
> http://wiki.apache.org/couchdb/Formatting_with_Show_and_List
>
> search for "example list function"
>
> doppler
>
> On Tue, Nov 2, 2010 at 10:22 PM, Robert Sosinski
> <em...@robertsosinski.com> wrote:
>> I have the following list function:
>>
>> function(head, req) {
>> send("<ul>");
>>
>> while(row = getRow()) {
>> send("<li>"+row.value.name+"</li>");
>> }
>>
>> send("</ul>");
>> }
>>
>> This function works except that it is being sent back with a ContentType of
>> "application/json". Is there any way to change the content type to
>> "text/html", similar to show functions?
>>
>> Thanks,
>>
>> -Robert
>>
>
Re: Setting ContentType For List Functions
Posted by David Rose <do...@gmail.com>.
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List
search for "example list function"
doppler
On Tue, Nov 2, 2010 at 10:22 PM, Robert Sosinski
<em...@robertsosinski.com> wrote:
> I have the following list function:
>
> function(head, req) {
> send("<ul>");
>
> while(row = getRow()) {
> send("<li>"+row.value.name+"</li>");
> }
>
> send("</ul>");
> }
>
> This function works except that it is being sent back with a ContentType of
> "application/json". Is there any way to change the content type to
> "text/html", similar to show functions?
>
> Thanks,
>
> -Robert
>