Commits

Benoit Chesneau committed e0768d2

key in params could be atom, binary or list

  • Participants
  • Parent commits 70d6632

Comments (0)

Files changed (3)

deps/lhttpc/util/make_doc.beam

Binary file removed.

src/couchbeam_db.erl

 %% @doc fetch attachment. 
 %% should be use to fetch the body
 fetch_attachment(Db, DocId, AName, Streaming)  ->
-    
     {C, Path, Options} = gen_server:call(db_pid(Db), {fetch_attachment, 
                 encode_docid(DocId), AName, Streaming}),
     case couchbeam_resource:get(C, Path, [], [], Options) of
     {ok, ViewPid} = gen_server:start_link(couchbeam_view, {Vname, Params, State}, []),
     {reply, ViewPid, State};
      
-handle_call({fetch_attachment, DocId, AName, Streaming}, From, #db{couchdb=C, base=Base}=State) ->
+handle_call({fetch_attachment, DocId, AName, Streaming}, _From, #db{couchdb=C, base=Base}=State) ->
     Path = io_lib:format("~s/~s/~s", [Base, DocId, AName]),
     Options = case Streaming of     
         true ->

src/couchbeam_resource.erl

                                    encode_query_value(K, V)] | Acc]
                            end, [], Props),
     lists:flatten(couchbeam_util:revjoin(RevPairs, $&, [])).
-        
+  
+encode_query_value(K,V) when is_atom(K) ->
+    encode_query_value(atom_to_list(K), V);
+encode_query_value(K,V) when is_binary(K) ->
+    encode_query_value(binary_to_list(K), V);
 encode_query_value(K,V) ->
     V1 = case K of
     "key"-> encode_value(V);