Skip to content

Commit 67319f0

Browse files
ansdmergify[bot]
authored andcommitted
Support negative integers in modified annotations
(cherry picked from commit b1064fd)
1 parent 46a0f56 commit 67319f0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

deps/amqp10_client/src/amqp10_client_session.erl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,8 +1180,13 @@ wrap_map_value(true) ->
11801180
{boolean, true};
11811181
wrap_map_value(false) ->
11821182
{boolean, false};
1183-
wrap_map_value(V) when is_integer(V) andalso V >= 0 ->
1184-
uint(V);
1183+
wrap_map_value(V) when is_integer(V) ->
1184+
case V < 0 of
1185+
true ->
1186+
{int, V};
1187+
false ->
1188+
uint(V)
1189+
end;
11851190
wrap_map_value(V) when is_binary(V) ->
11861191
utf8(V);
11871192
wrap_map_value(V) when is_list(V) ->

deps/rabbit/test/amqp_client_SUITE.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ modified_dead_letter_history(Config) ->
775775
#{<<"x-opt-history-list">> => {list, [{int, -99} | L1]},
776776
<<"x-opt-history-map">> => {map, [{{symbol, <<"k2">>}, {symbol, <<"v2">>}} | L2]},
777777
<<"x-opt-history-array">> => {array, utf8, [{utf8, <<"a2">>} | L0]},
778-
<<"x-other">> => 99}}),
778+
<<"x-other">> => -99}}),
779779

780780
{ok, Msg3} = amqp10_client:get_msg(Receiver1),
781781
?assertEqual([<<"m">>], amqp10_msg:body(Msg3)),
@@ -786,7 +786,7 @@ modified_dead_letter_history(Config) ->
786786
<<"x-opt-history-list">> := [{int, -99}, {utf8, <<"l1">>}],
787787
<<"x-opt-history-map">> := [{{symbol, <<"k2">>}, {symbol, <<"v2">>}},
788788
{{symbol, <<"k1">>}, {byte, -1}}],
789-
<<"x-other">> := 99}, amqp10_msg:message_annotations(Msg3)),
789+
<<"x-other">> := -99}, amqp10_msg:message_annotations(Msg3)),
790790
ok = amqp10_client:accept_msg(Receiver1, Msg3),
791791

792792
ok = detach_link_sync(Receiver1),

0 commit comments

Comments
 (0)