aboutsummaryrefslogtreecommitdiff
path: root/src/mod_http_api.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2018-10-31 01:33:07 +0100
committerBadlop <badlop@process-one.net>2018-10-31 01:34:04 +0100
commita73aac691e8cff0c61f185e523ea0c5861aaf87a (patch)
tree6484c0758ea1a088a6bab0c309da5afcc1201e75 /src/mod_http_api.erl
parentDon't hide result of mod_*:set_* calls (diff)
Don't preprocess arguments, format_args verifies and prepares them (#2629)
Diffstat (limited to 'src/mod_http_api.erl')
-rw-r--r--src/mod_http_api.erl17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl
index 3bea1437d..4d4a40f79 100644
--- a/src/mod_http_api.erl
+++ b/src/mod_http_api.erl
@@ -274,20 +274,8 @@ handle(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
case ejabberd_commands:get_command_format(Call, Auth, Version) of
{ArgsSpec, _} when is_list(ArgsSpec) ->
Args2 = [{misc:binary_to_atom(Key), Value} || {Key, Value} <- Args],
- Spec = lists:foldr(
- fun ({Key, binary}, Acc) ->
- [{Key, <<>>}|Acc];
- ({Key, string}, Acc) ->
- [{Key, ""}|Acc];
- ({Key, integer}, Acc) ->
- [{Key, 0}|Acc];
- ({Key, {list, _}}, Acc) ->
- [{Key, []}|Acc];
- ({Key, atom}, Acc) ->
- [{Key, undefined}|Acc]
- end, [], ArgsSpec),
try
- handle2(Call, Auth, match(Args2, Spec), Version)
+ handle2(Call, Auth, Args2, Version)
catch throw:not_found ->
{404, <<"not_found">>};
throw:{not_found, Why} when is_atom(Why) ->
@@ -431,9 +419,6 @@ process_unicode_codepoints(Str) ->
%% internal helpers
%% ----------------
-match(Args, Spec) ->
- [{Key, proplists:get_value(Key, Args, Default)} || {Key, Default} <- Spec].
-
format_command_result(Cmd, Auth, Result, Version) ->
{_, ResultFormat} = ejabberd_commands:get_command_format(Cmd, Auth, Version),
case {ResultFormat, Result} of