From 1d241bc39c91fbdd2a967abbce38d78f91b45439 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Tue, 13 Apr 2021 19:15:50 +0800 Subject: [PATCH] fix(webhook): convert atom to binary to avoid jiffy encoding failure --- apps/emqx_web_hook/src/emqx_web_hook.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/emqx_web_hook/src/emqx_web_hook.erl b/apps/emqx_web_hook/src/emqx_web_hook.erl index 6c63d6d49..51f336768 100644 --- a/apps/emqx_web_hook/src/emqx_web_hook.erl +++ b/apps/emqx_web_hook/src/emqx_web_hook.erl @@ -378,8 +378,10 @@ encode_payload(Payload, base62) -> emqx_base62:encode(Payload); encode_payload(Payload, base64) -> base64:encode(Payload); encode_payload(Payload, plain) -> Payload. -stringfy(Term) when is_atom(Term); is_binary(Term) -> +stringfy(Term) when is_binary(Term) -> Term; +stringfy(Term) when is_atom(Term) -> + atom_to_binary(Term, utf8); stringfy(Term) -> unicode:characters_to_binary((io_lib:format("~0p", [Term]))).