incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: _temp_view insists on Content-Type
Date Thu, 02 Apr 2009 19:20:47 GMT
My initial reaction would be to add checks to the rest of the API but
I fear that it'd cause some pain for users of access mechanisms that
either make adding headers difficult or things like curl where its
just a pain.

On Thu, Apr 2, 2009 at 3:12 PM, Brian Candler <B.Candler@pobox.com> wrote:
> It seems to be inconsistent that a POST to _temp_view only works if
> Content-Type: application/json is provided, whereas in every other part of
> the API I've exercised so far it's not needed (example below).
>
> I see there is explicit code enforcing this, in
> couch_httpd_view:handle_temp_view_req/2
>
> Could someone explain what the reason is for this?
>
> Thanks,
>
> Brian.
>
> $ curl -X POST -d '{"map":"function(doc) { emit(null, null) }"}'
> http://127.0.0.1:5984/couchtiny-test/_temp_view
> {"error":"incorrect_mime_type","reason":"application/x-www-form-urlencoded"}
> $ curl -X POST -d '{"map":"function(doc) { emit(null, null) }"}' -H "Content-Type: application/json"
http://127.0.0.1:5984/couchtiny-test/_temp_view
> {"total_rows":3,"offset":0,"rows":[
> {"id":"fred","key":null,"value":null},
> {"id":"jim","key":null,"value":null},
> {"id":"trunky","key":null,"value":null}
> ]}
>

Mime
View raw message