couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Young (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COUCHDB-2181) Show function with provides() fails to handle `json` key
Date Fri, 28 Feb 2014 15:30:20 GMT
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)

Mime
View raw message