In frontends, if result is in binary then convert to string
This commit is contained in:
@@ -347,9 +347,12 @@ format_result(Atom, {_Name, atom}) ->
|
||||
format_result(Int, {_Name, integer}) ->
|
||||
io_lib:format("~p", [Int]);
|
||||
|
||||
format_result(String, {_Name, string}) ->
|
||||
format_result(String, {_Name, string}) when is_list(String) ->
|
||||
io_lib:format("~s", [String]);
|
||||
|
||||
format_result(Binary, {_Name, string}) when is_binary(Binary) ->
|
||||
io_lib:format("~s", [binary_to_list(Binary)]);
|
||||
|
||||
format_result(Code, {_Name, rescode}) ->
|
||||
make_status(Code);
|
||||
|
||||
|
||||
@@ -405,9 +405,9 @@ format_result(Atom, {Name, atom}) ->
|
||||
[{Name, iolist_to_binary(atom_to_list(Atom))}]};
|
||||
format_result(Int, {Name, integer}) ->
|
||||
{struct, [{Name, Int}]};
|
||||
format_result(String, {Name, string}) ->
|
||||
format_result(String, {Name, string}) when is_list(String) ->
|
||||
{struct, [{Name, lists:flatten(String)}]};
|
||||
format_result(Binary, {Name, binary}) ->
|
||||
format_result(Binary, {Name, string}) when is_binary(Binary) ->
|
||||
{struct, [{Name, binary_to_list(Binary)}]};
|
||||
format_result(Code, {Name, rescode}) ->
|
||||
{struct, [{Name, make_status(Code)}]};
|
||||
|
||||
Reference in New Issue
Block a user