[
https://issues.apache.org/jira/browse/COUCHDB-2881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005894#comment-15005894
]
Alexander Shorin commented on COUCHDB-2881:
-------------------------------------------
This is strange side effect caused by COUCHDB-1876. For 2.0 we have different
fix for the same issue that works correctly.
> `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)