couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <>
Subject Re: svn commit: r657926
Date Wed, 21 May 2008 11:17:22 GMT
On 21.05.2008, at 12:36, Noah Slater wrote:
> On Tue, May 20, 2008 at 10:17:55AM -0700, David Reid wrote:
>> It's because we no longer use content-type to describe the  
>> programming
>> language, which always seemed dubious to me anyway.
> Not sure, but I think this might be a mistake.
>> From IRC I gather that the content type of views POSTed to CouchDB  
>> is now
> indicated with a "language" attribute in the request body. This  
> feels a little
> be RPCish, should we not be leveraging the HTTP level stuff for  
> specifying the
> content type of views POSTed to CouchDB?

That has changed. While previously you posted the raw code to temp  
views, and thus it was correct and appropriate to use the Content-Type  
header to determine the view server language, you now post a JSON  
object, and thus the correct Content-Type is application/json.

   POST /db/_temp_view
   Content-Type: application/json

     "map": "function(doc) { ... }",
     "reduce": ...,
     "language": ...

(The background for this change is of course the introduction of the  
reduce part).

There is really no correct way anymore to convey the view server  
language via the Content-Type header (because the content is JSON),  
therefore it has been moved into the JSON structure itself. And  
because there's now not a single place where we specify the view  
server language via the Content-Type header, there's really no reason  
to be requiring MIME types at all.

Christopher Lenz
   cmlenz at

View raw message