From 723bcdcb75b838de0ec396879b3e0e22464659d8 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Tue, 17 May 2016 14:39:43 -0400 Subject: [PATCH] Increase JSON conversation coverage --- deps/rabbitmq_aws/src/httpc_aws_json.erl | 6 +++--- deps/rabbitmq_aws/test/httpc_aws_json_tests.erl | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deps/rabbitmq_aws/src/httpc_aws_json.erl b/deps/rabbitmq_aws/src/httpc_aws_json.erl index 10cdd36d23..198dca402a 100644 --- a/deps/rabbitmq_aws/src/httpc_aws_json.erl +++ b/deps/rabbitmq_aws/src/httpc_aws_json.erl @@ -29,10 +29,10 @@ convert_binary_values([{K, V}|T], Accum) when is_binary(V) -> convert_binary_values([{K, V}|T], Accum) -> convert_binary_values(T, lists:append(Accum, [{binary_to_list(K), V}])); convert_binary_values([H|T], Accum) when is_binary(H) -> -convert_binary_values(T, lists:append(Accum, [binary_to_list(H)])); + convert_binary_values(T, lists:append(Accum, [binary_to_list(H)])); convert_binary_values([H|T], Accum) when is_integer(H) -> -convert_binary_values(T, lists:append(Accum, [H])); + convert_binary_values(T, lists:append(Accum, [H])); convert_binary_values([H|T], Accum) when is_atom(H) -> -convert_binary_values(T, lists:append(Accum, [H])); + convert_binary_values(T, lists:append(Accum, [H])); convert_binary_values([H|T], Accum) -> convert_binary_values(T, lists:append(Accum, convert_binary_values(H, []))). diff --git a/deps/rabbitmq_aws/test/httpc_aws_json_tests.erl b/deps/rabbitmq_aws/test/httpc_aws_json_tests.erl index a891607470..c8abf74bb1 100644 --- a/deps/rabbitmq_aws/test/httpc_aws_json_tests.erl +++ b/deps/rabbitmq_aws/test/httpc_aws_json_tests.erl @@ -48,6 +48,11 @@ parse_test_() -> {"key","aws:cloudformation:stack-name"}, {"value","prod-us-east-1-ecs-1"}]} ], + ?assertEqual(Expectation, httpc_aws_json:decode(Value)) + end}, + {"list values", fun() -> + Value = "{\"misc\": [\"foo\", true, 123]\}", + Expectation = [{"misc", ["foo", true, 123]}], ?assertEqual(Expectation, httpc_aws_json:decode(Value)) end} ].