couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Young (JIRA)" <>
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
             Project: CouchDB
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: JavaScript View Server
            Reporter: Benjamin Young

The documentation for [Show functions|]
has the following code:
function(doc, req){
  provides('json', function(){
    return {'json': doc}

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

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

View raw message