aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_codec.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-07-06 12:07:36 +0200
committerAnders Svensson <[email protected]>2017-08-03 17:14:27 +0200
commitd52611e9bd0628affa7b4f56a6126e4a99b69a7a (patch)
tree6dc7cae62bd1ba105e4f2e2ccfd32ed923c9dceb /lib/diameter/src/base/diameter_codec.erl
parent1b3b64af3d9a5441b6da37cf4e97b59cb043f33b (diff)
downloadotp-d52611e9bd0628affa7b4f56a6126e4a99b69a7a.tar.gz
otp-d52611e9bd0628affa7b4f56a6126e4a99b69a7a.tar.bz2
otp-d52611e9bd0628affa7b4f56a6126e4a99b69a7a.zip
Let messages and grouped AVPs be decoded to lists
That is, decode to the same format that encode already accepts. Only a message has its name at the head of the list since AVPs are already name/value pairs.
Diffstat (limited to 'lib/diameter/src/base/diameter_codec.erl')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index 0c43d52093..9043af145e 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -379,10 +379,16 @@ decode_avps(MsgName, Mod, AppMod, Opts, Pkt, Avps) -> %% ... or not
Opts#{dictionary => AppMod,
failed_avp => false}),
?LOGC([] /= Errors, decode_errors, Pkt#diameter_packet.header),
- Pkt#diameter_packet{msg = Rec,
+ Pkt#diameter_packet{msg = reformat(MsgName, Rec, Opts),
errors = Errors,
avps = As}.
+reformat(MsgName, Avps, #{decode_format := list}) ->
+ [MsgName | Avps];
+
+reformat(_, Msg, _) ->
+ Msg.
+
%%% ---------------------------------------------------------------------------
%%% # decode_header/1
%%% ---------------------------------------------------------------------------