This commit is contained in:
anlicheng 2024-09-10 16:02:37 +08:00
parent ac6ea78aa4
commit 766ac31b4f

View File

@ -30,6 +30,7 @@ init(Req0, Opts) ->
}, Resp, Req1), }, Resp, Req1),
{ok, Req2, Opts}; {ok, Req2, Opts};
false -> false ->
lager:debug("[api_handler] invalid sign: ~p", [Sign]),
Req2 = cowboy_req:reply(500, #{ Req2 = cowboy_req:reply(500, #{
<<"Content-Type">> => <<"text/html;charset=utf-8">> <<"Content-Type">> => <<"text/html;charset=utf-8">>
}, <<"Internal Server Error">>, Req1), }, <<"Internal Server Error">>, Req1),
@ -39,7 +40,7 @@ init(Req0, Opts) ->
handle_request("POST", "/api/device_info", _, Params) -> handle_request("POST", "/api/device_info", _, Params) ->
njau_bot_logger:write(jiffy:encode(Params, [force_utf8])), njau_bot_logger:write(jiffy:encode(Params, [force_utf8])),
{ok, 200, json_data(<<"hello world">>)}; {ok, 200, json_data(<<"ok">>)};
handle_request(_, Path, _, _) -> handle_request(_, Path, _, _) ->
Path1 = list_to_binary(Path), Path1 = list_to_binary(Path),