aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2018-12-03 13:52:04 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2018-12-03 13:53:07 +0100
commit59a148d80b0a61855b46ce9c3a15a4aa580d01a6 (patch)
treedcaa07d1f4a3361bff756830cedfe172cc5ce07a /src
parentKeep info about carbons inside session table (diff)
Make mod_http_api assume that missing args of type list are empty list
Diffstat (limited to 'src')
-rw-r--r--src/mod_http_api.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl
index 4d4a40f79..e3c7b3bc7 100644
--- a/src/mod_http_api.erl
+++ b/src/mod_http_api.erl
@@ -325,15 +325,20 @@ handle2(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
format_command_result(Call, Auth, Res, Version)
end.
-get_elem_delete(A, L) ->
+get_elem_delete(A, L, F) ->
case proplists:get_all_values(A, L) of
[Value] -> {Value, proplists:delete(A, L)};
[_, _ | _] ->
%% Crash reporting the error
exit({duplicated_attribute, A, L});
[] ->
- %% Report the error and then force a crash
- exit({attribute_not_found, A, L})
+ case F of
+ {list, _} ->
+ {[], L};
+ _ ->
+ %% Report the error and then force a crash
+ exit({attribute_not_found, A, L})
+ end
end.
format_args(Args, ArgsFormat) ->
@@ -342,7 +347,7 @@ format_args(Args, ArgsFormat) ->
{Args1, Res}) ->
{ArgValue, Args2} =
get_elem_delete(ArgName,
- Args1),
+ Args1, ArgFormat),
Formatted = format_arg(ArgValue,
ArgFormat),
{Args2, Res ++ [Formatted]}