Permalink
Browse files

More robust header building if the header is a string already

  • Loading branch information...
1 parent 05a6697 commit d10ee189fdcee2a95a07efe0a5abe35839e4b96c @jhs jhs committed Dec 1, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/somdune_net.erl
View
@@ -244,7 +244,13 @@ make_request(Method, PathTuple, Version) ->
end].
make_headers(Headers) ->
- [ [ [atom_to_list(Key), <<": ">>, Value, <<"\r\n">> ] || {Key, Value} <- Headers ] , <<"\r\n">>].
+ ToKey = fun(Key) ->
+ if
+ is_atom(Key) -> atom_to_list(Key);
+ true -> Key
+ end
+ end,
+ [ [ [ToKey(Key), <<": ">>, Value, <<"\r\n">> ] || {Key, Value} <- Headers ] , <<"\r\n">>].
request_to_binary(Req) ->

0 comments on commit d10ee18

Please sign in to comment.