aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-07-13 13:18:19 +0200
committerAnders Svensson <[email protected]>2017-08-03 17:16:34 +0200
commit9adab9b89d49e7c8706e34b87be7d5123ce181cd (patch)
tree59c4ba9c711ce397496d31d1502f2e359a6a6cdf /lib
parent66bb5251e89487c5fb8c1f10b8ceb2c6c8f31eed (diff)
downloadotp-9adab9b89d49e7c8706e34b87be7d5123ce181cd.tar.gz
otp-9adab9b89d49e7c8706e34b87be7d5123ce181cd.tar.bz2
otp-9adab9b89d49e7c8706e34b87be7d5123ce181cd.zip
Be forgiving of non-list values at encode
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/src/base/diameter_gen.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/diameter/src/base/diameter_gen.erl b/lib/diameter/src/base/diameter_gen.erl
index 243bc7965a..3d0612c294 100644
--- a/lib/diameter/src/base/diameter_gen.erl
+++ b/lib/diameter/src/base/diameter_gen.erl
@@ -124,9 +124,12 @@ enc(_, _, {0,_}, [], _, _) ->
enc(_, _, _, undefined, _, _) ->
[];
-enc(_, AvpName, _, T, _, _)
- when not is_list(T) ->
- ?THROW([repeated_avp_as_non_list, AvpName, T]);
+%% Be forgiving when a list of values is expected. If the value itself
+%% is a list then the user has to wrap it to avoid each member from
+%% being interpreted as an individual AVP value.
+enc(Name, AvpName, Arity, V, Opts, Mod)
+ when not is_list(V) ->
+ enc(Name, AvpName, Arity, [V], Opts, Mod);
enc(Name, AvpName, {Min, Max}, Values, Opts, Mod) ->
H = avp_header(AvpName, Mod),