incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Leddy <m...@loop.com.br>
Subject Re: Unexpected response for ?open_revs=all
Date Wed, 13 Jul 2011 12:03:52 GMT
Hi Jens,

You can get the behaviour you want if you can set the Accept header in the
http request ie:


$ curl -i -H 'Accept: application/json' 'http://127.0.0.1:5984/test/one?open_revs=all'
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: CouchDB/1.2.0a-0e1af07-git (Erlang OTP/R14B03)
Date: Wed, 13 Jul 2011 12:00:23 GMT
Content-Type: application/json
Cache-Control: must-revalidate

[{"ok":{"_id":"one","_rev":"2-7051cbe5c8faecd085a3fa619e6e6337"}}]

As opposed to:

$ curl -i 'http://127.0.0.1:5984/test/one?open_revs=all'
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: CouchDB/1.2.0a-0e1af07-git (Erlang OTP/R14B03)
Date: Wed, 13 Jul 2011 12:02:19 GMT
Content-Type: multipart/mixed; boundary="2d29ffaa2362c73c3c22a9d434aa8859"

--2d29ffaa2362c73c3c22a9d434aa8859
Content-Type: application/json

{"_id":"one","_rev":"2-7051cbe5c8faecd085a3fa619e6e6337"}
--2d29ffaa2362c73c3c22a9d434aa8859--

Regards,

Mike

On Tue, 2011-07-12 at 18:38 -0700, Jens Alfke wrote:
> I’m trying to get a list of conflicting revisions by using the “?open_revs=all”
query parameter, as described in the conflict documentation in the wiki[1]. But when I test
this with curl, the output is completely unexpected — instead of a JSON array as documented,
I get a MIME multipart body. What’s going on?
> 
> In this example the document isn’t actually in conflict, as I haven’t synthesized
a conflict in my test database yet (though I will soon thanks to Paul’s handy Python script!)
> 
> $ curl -i 'http://127.0.0.1:5984/db/3aaa5e74e5d96db3b2248fb1c404eb65?open_revs=all’
> HTTP/1.1 200 OK
> Transfer-Encoding: chunked
> Server: CouchDB/1.2.0a-eb77a97-git (Erlang OTP/R14B01)
> Date: Wed, 13 Jul 2011 01:16:36 GMT
> Content-Type: multipart/mixed; boundary="5316aac5e82bfd1b98ba15d212819f24"
> 
> --5316aac5e82bfd1b98ba15d212819f24
> Content-Type: application/json
> 
> {"_id":"3aaa5e74e5d96db3b2248fb1c404eb65","_rev":"7-7e833e1c2ee3db8e4ae3f615c20ca592","first":"Jens","last":"Alfke","email":"jens@mooseyard.com"}
> --5316aac5e82bfd1b98ba15d212819f24—
> 
> —Jens
> 
> [1] http://wiki.apache.org/couchdb/Replication_and_conflicts



Mime
View raw message