aboutsummaryrefslogtreecommitdiff
path: root/src/rest.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rest.erl')
-rw-r--r--src/rest.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rest.erl b/src/rest.erl
index d724352f2..1bb5c5ef7 100644
--- a/src/rest.erl
+++ b/src/rest.erl
@@ -191,13 +191,26 @@ base_url(Server, Path) ->
_ -> Url
end.
+-ifdef(HAVE_URI_STRING).
+uri_hack(Str) ->
+ case uri_string:normalize("%25") of
+ "%" -> % This hack around bug in httpc >21 <23.2
+ binary:replace(Str, <<"%25">>, <<"%2525">>, [global]);
+ _ -> Str
+ end.
+-else.
+uri_hack(Str) ->
+ Str.
+-endif.
+
url(Url, []) ->
Url;
url(Url, Params) ->
L = [<<"&", (iolist_to_binary(Key))/binary, "=",
(misc:url_encode(Value))/binary>>
|| {Key, Value} <- Params],
- <<$&, Encoded/binary>> = iolist_to_binary(L),
+ <<$&, Encoded0/binary>> = iolist_to_binary(L),
+ Encoded = uri_hack(Encoded0),
<<Url/binary, $?, Encoded/binary>>.
url(Server, Path, Params) ->
case binary:split(base_url(Server, Path), <<"?">>) of