I am trying to return text/plain from a couchdb list but it is not working. The content is returned correctly but the content type seems to be forced to application/json.
Code snippet is
start({ "headers" : {"Content-type" : "text/plain"}});
send("Nono, you can't do this");
Before this code there is one getRow invoked. If I remove that the text/plain content type is returned as expected.
Not sure what is going wrong here and I can’t really avoid the getRow as the result of that determines the content type to return.
Any guidance warmly welcomed!
CouchDB starts the response (including sending the default Content-Type header) when you first call getRow(), so what you are seeing is expected behaviour.
Submit a ticket to our JIRA (http://issues.apache.org/jira/browse/COUCHDB), though, and perhaps it can be delayed, allowing the useful effect you are attempting.