You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Benjamin Young (JIRA)" <ji...@apache.org> on 2015/11/15 04:39:10 UTC

[jira] [Created] (COUCHDB-2881) `json` response key (in _show, _list, _update) forces `text/plain` Content-Type

Benjamin Young created COUCHDB-2881:
---------------------------------------

             Summary: `json` response key (in _show, _list, _update) forces `text/plain` Content-Type
                 Key: COUCHDB-2881
                 URL: https://issues.apache.org/jira/browse/COUCHDB-2881
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
            Reporter: Benjamin Young


In a _show function, this function returns {{text/plain}}:
{code:javascript}
function(doc, req) {
  return {
    json: req
  };
  // my expectation was that it would return application/json
}
{code}

...which isn't what I expected...but then this one *also* returns `text/plain`...and it really shouldn't:
{code:javascript}
function(doc, req) {
  return {
    headers: {
      'Content-Type': 'application/json'
    },
    json: req
  };
  // response header is still text/plain
}
{code}

However, this works as it should:
{code:javascript}
function(doc, req) {
  return {
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(req)
  };
  // response header is now application/json as intended
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)