From f6b9ce84e54f7018e72cf9a197c6c48d7a28d5d5 Mon Sep 17 00:00:00 2001 From: turtled Date: Fri, 18 Aug 2017 11:44:11 +0800 Subject: [PATCH] Update kick_client API --- src/emqttd_cli_config.erl | 4 +--- src/emqttd_rest_api.erl | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/emqttd_cli_config.erl b/src/emqttd_cli_config.erl index d2fcf09c5..aca2a45bb 100644 --- a/src/emqttd_cli_config.erl +++ b/src/emqttd_cli_config.erl @@ -339,6 +339,4 @@ any_to_string(A) when is_atom(A) -> any_to_string(B) when is_binary(B) -> binary_to_list(B); any_to_string(L) when is_list(L) -> - L. - - + L. \ No newline at end of file diff --git a/src/emqttd_rest_api.erl b/src/emqttd_rest_api.erl index 91d75c483..cc4154873 100644 --- a/src/emqttd_rest_api.erl +++ b/src/emqttd_rest_api.erl @@ -24,7 +24,7 @@ -http_api({"^nodes/(.+?)/clients/?$", 'GET', client_list, []}). -http_api({"^nodes/(.+?)/clients/(.+?)/?$", 'GET',client_list, []}). -http_api({"^clients/(.+?)/?$", 'GET', client, []}). --http_api({"^kick_client/(.+?)/?$", 'PUT', kick_client, []}). +-http_api({"^clients/(.+?)/?$", 'DELETE', kick_client, []}). -http_api({"^clean_acl_cache/(.+?)/?$", 'PUT', clean_acl_cache, [{<<"topic">>, binary}]}). -http_api({"^routes?$", 'GET', route_list, []}). @@ -112,7 +112,7 @@ client_list('GET', Params, Node, Key) -> Data = emqttd_mgmt:client_list(l2a(Node), l2b(Key), PageNo, PageSize), {ok, [{objects, [client_row(Row) || Row <- Data]}]}. -kick_client('PUT', _Params, Key) -> +kick_client('DELETE', _Params, Key) -> case emqttd_mgmt:kick_client(l2b(Key)) of true -> {ok, []}; false -> {error, [{code, ?ERROR12}]} @@ -448,4 +448,4 @@ b2l(B) -> binary_to_list(B). page_params(Params) -> PageNo = int(proplists:get_value("curr_page", Params, "1")), PageSize = int(proplists:get_value("page_size", Params, "20")), - {PageNo, PageSize}. \ No newline at end of file + {PageNo, PageSize}.