benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Unable to upload files through PUT #17

Closed Tyra-Bjurman closed 13 years ago

Tyra-Bjurman commented 14 years ago

Using curl I can do: curl -X PUT localhost:5984/test/testdoc --data-binary @test.json {"ok":true,"id":"testdoc","rev":"1-5d251ed7bd4dbf3c458b58b626d57b78"}

the file test.json contains: { "test":"foobar" } and is hence correctly evaluated and created as a document.

However trying to do the same in couchbeam yields: 1> couchbeam:start(). \ Found 0 name clashes in code paths ok 2> couchbeam_server:start_connection_link(). <0.61.0> 3> couchbeam_server:open_db(default, {test, "test"}). <0.67.0> 4> {ok, Test} = file:read_file("test.json").
{ok,<<"{ \n\t\"test\":\"foobar\" \n}\n">>}

5> couchbeam_resource:put(default, "127.0.0.1:5984/test/testdoc", [], [], Test, []). \ exception error: no function clause matching couchbeam_resource:make_auth(default,[]) in function couchbeam_resource:request/7

benoitc commented 13 years ago

Fixed in last head. It's also easier to put files as attachment with new api :

http://github.com/benoitc/couchbeam/blob/master/t/006-attachment.t#L85

Thanks for the feedback :)