diff --git a/src/hz_grids.erl b/src/hz_grids.erl index 7e54aa1..6a9c6de 100644 --- a/src/hz_grids.erl +++ b/src/hz_grids.erl @@ -88,7 +88,7 @@ url(Instruction, Recipient, Amount) -> Node :: {inet:ip_address() | inet:hostname(), inet:port_number()} | uri_string:uri_string(), % "http://..." | "https://..." Recipient :: string(), - Amount :: non_neg_integer(), + Amount :: non_neg_integer() | none, Payload :: binary(), GRIDS :: uri_string:uri_string(). %% @doc @@ -113,8 +113,12 @@ h_to_s(Host) when is_binary(Host) -> Host; h_to_s(Host) when is_tuple(Host) -> inet:ntoa(Host); h_to_s(Host) when is_atom(Host) -> atom_to_list(Host). +qwargs(none, "") -> + []; qwargs(Amount, "") -> ["?a=", integer_to_list(Amount)]; +qwargs(none, Payload) -> + [$? | uri_string:compose_query([{"p", Payload}])]; qwargs(Amount, Payload) -> [$? | uri_string:compose_query([{"a", integer_to_list(Amount)}, {"p", Payload}])].