On Thu, Apr 23, 2009 at 01:53:09PM +0530, Debasish Ghosh wrote:
> $ curl -vX POST -H "Content-Type: application/json" -d '{"map" :
> "function(doc) { emit(null, doc) }"}'
> http://localhost:5984/hello-world/_tmp_view
>
> the error that I get is the following ..
>
> {"error":"bad_content_type","reason":"Invalid Content-Type header for form
> upload"}
It's _temp_view, not _tmp_view.
There have been some changes made recently which mean that POSTs which
aren't application/x-form-post are rejected. However names beginning with an
underscore are reserved.
A quick check suggests that things are a bit too lax: a PUT to /db/_tmp_view
actually creates a document with id _tmp_view (I would have thought this
should be rejected?)
I believe it's possible to use POST to create an attachment. Perhaps CouchDB
thinks that your post to /db/_tmp_view is an attempt to create an attachment
on a document whose id is _tmp_view?
It's certainly a very confusing error.
Regards,
Brian.