|
|
@@ -405,7 +405,7 @@ on_query(
|
|
|
reason => Reason,
|
|
|
connector => InstId
|
|
|
}),
|
|
|
- Result;
|
|
|
+Result;
|
|
|
_Success ->
|
|
|
Result
|
|
|
end.
|
|
|
@@ -703,17 +703,22 @@ process_request(
|
|
|
}.
|
|
|
|
|
|
render_request_body(undefined, _, Msg) ->
|
|
|
- encode_payload_with_base64(Msg),
|
|
|
- emqx_utils_json:encode(Msg);
|
|
|
+ ?SLOG(debug, #{msg => "render_request_body111"}),
|
|
|
+ EncodedMsg = encode_payload_with_base64(Msg),
|
|
|
+ emqx_utils_json:encode(EncodedMsg);
|
|
|
render_request_body(BodyTks, RenderTmplFunc, Msg) ->
|
|
|
+ ?SLOG(debug, #{msg => "render_request_body222"}),
|
|
|
MsgWithBase64 = encode_payload_with_base64(Msg),
|
|
|
RenderTmplFunc(BodyTks, MsgWithBase64).
|
|
|
|
|
|
encode_payload_with_base64(Msg) ->
|
|
|
- Payload = maps:get(<<"payload">>, Msg, <<>>),
|
|
|
+ Payload = maps:get(payload, Msg, <<>>),
|
|
|
Base64Payload = base64:encode(Payload),
|
|
|
- maps:put(<<"base64_payload">>, Base64Payload, Msg).
|
|
|
+ maps:put(payload, Base64Payload, Msg).
|
|
|
|
|
|
+% 辅助函数:将二进制数据转换为16进制字符串
|
|
|
+binary_to_hex(Bin) ->
|
|
|
+ lists:flatten([io_lib:format("~2.16.0B", [Byte]) || <<Byte>> <= Bin]).
|
|
|
render_headers(HeaderTks, RenderTmplFunc, Msg) ->
|
|
|
lists:map(
|
|
|
fun({K, V}) ->
|
|
|
@@ -913,4 +918,4 @@ join_paths_test_() ->
|
|
|
?_assertEqual("abc///cde/", join_paths("abc//", "//cde/"))
|
|
|
].
|
|
|
|
|
|
--endif.
|
|
|
+-endif.
|