Преглед изворни кода

fix(log): fix web hook print error

zhanghongtong пре 4 година
родитељ
комит
98c62df2e4
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 1 1
      apps/emqx_web_hook/src/emqx_web_hook.erl
  2. 2 2
      apps/emqx_web_hook/test/http_server.erl

+ 1 - 1
apps/emqx_web_hook/src/emqx_web_hook.erl

@@ -325,7 +325,7 @@ send_http_request(ClientID, Params) ->
     {ok, Path} = application:get_env(?APP, path),
     Headers = application:get_env(?APP, headers, []),
     Body = emqx_json:encode(Params),
-    ?LOG(debug, "Send to: ~0p, params: ~0s", [Path, Body]),
+    ?LOG(debug, "Send to: ~0p, params: ~s", [Path, Body]),
     case ehttpc:request(ehttpc_pool:pick_worker(?APP, ClientID), post, {Path, Headers, Body}) of
         {ok, StatusCode, _} when StatusCode >= 200 andalso StatusCode < 300 ->
             ok;

+ 2 - 2
apps/emqx_web_hook/test/http_server.erl

@@ -12,7 +12,7 @@
 -export([start_link/0]).
 -export([get_received_data/0]).
 -export([stop/1]).
--export([code_change/3, handle_call/3, handle_cast/2, handle_info/2, init/1, terminate/2]).
+-export([code_change/3, handle_call/3, handle_cast/2, handle_info/2, init/1, init/2, terminate/2]).
 -define(HTTP_PORT, 9999).
 -define(HTTPS_PORT, 8888).
 -record(state, {}).
@@ -102,4 +102,4 @@ init(Req, State) ->
 reply(Req, ok) ->
     cowboy_req:reply(200, #{<<"content-type">> => <<"text/plain">>}, <<"ok">>, Req);
 reply(Req, error) ->
-    cowboy_req:reply(404, #{<<"content-type">> => <<"text/plain">>}, <<"deny">>, Req).
+    cowboy_req:reply(404, #{<<"content-type">> => <<"text/plain">>}, <<"deny">>, Req).