Benjamin Young created COUCHDB-2181:
---------------------------------------
Summary: Show function with provides() fails to handle `json` key
Key: COUCHDB-2181
URL: https://issues.apache.org/jira/browse/COUCHDB-2181
Project: CouchDB
Issue Type: Bug
Security Level: public (Regular issues)
Components: JavaScript View Server
Reporter: Benjamin Young
The documentation for [Show
functions|http://docs.couchdb.org/en/latest/couchapp/ddocs.html#show-functions]
has the following code:
{code:javascript}
function(doc, req){
provides('json', function(){
return {'json': doc}
});
}
{code}
However, using that returns an empty body—though it does properly set
Content-Type, etc.
The cause is that the ‘json’ key is not checked/processed by the Mime and/or
Render code, but should be if the response type is JSON (at least).
Short term fix: update the docs to use the {{\{body: JSON.stringify(doc)\}}}
return value instead.
Long(er) term / more-correct fix: fix the Mime/Render code to address…and then
put the docs back the way they are currently (if we did the short term fix).
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)