Allow for a 'none' amount to prompt users for an amount.
This commit is contained in:
parent
88c6f6dcc7
commit
f5e955b583
@ -88,7 +88,7 @@ url(Instruction, Recipient, Amount) ->
|
|||||||
Node :: {inet:ip_address() | inet:hostname(), inet:port_number()}
|
Node :: {inet:ip_address() | inet:hostname(), inet:port_number()}
|
||||||
| uri_string:uri_string(), % "http://..." | "https://..."
|
| uri_string:uri_string(), % "http://..." | "https://..."
|
||||||
Recipient :: string(),
|
Recipient :: string(),
|
||||||
Amount :: non_neg_integer(),
|
Amount :: non_neg_integer() | none,
|
||||||
Payload :: binary(),
|
Payload :: binary(),
|
||||||
GRIDS :: uri_string:uri_string().
|
GRIDS :: uri_string:uri_string().
|
||||||
%% @doc
|
%% @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_tuple(Host) -> inet:ntoa(Host);
|
||||||
h_to_s(Host) when is_atom(Host) -> atom_to_list(Host).
|
h_to_s(Host) when is_atom(Host) -> atom_to_list(Host).
|
||||||
|
|
||||||
|
qwargs(none, "") ->
|
||||||
|
[];
|
||||||
qwargs(Amount, "") ->
|
qwargs(Amount, "") ->
|
||||||
["?a=", integer_to_list(Amount)];
|
["?a=", integer_to_list(Amount)];
|
||||||
|
qwargs(none, Payload) ->
|
||||||
|
[$? | uri_string:compose_query([{"p", Payload}])];
|
||||||
qwargs(Amount, Payload) ->
|
qwargs(Amount, Payload) ->
|
||||||
[$? | uri_string:compose_query([{"a", integer_to_list(Amount)}, {"p", Payload}])].
|
[$? | uri_string:compose_query([{"a", integer_to_list(Amount)}, {"p", Payload}])].
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user