[
https://issues.apache.org/jira/browse/COUCHDB-2881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005750#comment-15005750
]
Alexander Shorin commented on COUCHDB-2881:
-------------------------------------------
Actually, first example forces to return doubled content type: {{text/plain;
charset=utf-8, application/json}} and if you explictly ask it accept
application/json then you'll get awkward {{Content-Type: application/json,
application/json}}. IIRC there was issue but such behaviour, but anyway good
reminder. This should be finally fixed (:
> `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)