From 96562dfc592c56d31151036d49c529d795df43fb Mon Sep 17 00:00:00 2001 From: turtled Date: Fri, 19 May 2017 10:22:07 +0800 Subject: [PATCH] Format code --- src/emqttd_http.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/emqttd_http.erl b/src/emqttd_http.erl index c9edca39f..389751ea2 100644 --- a/src/emqttd_http.erl +++ b/src/emqttd_http.erl @@ -88,8 +88,7 @@ handle_request(Method, Path, Req) -> %%-------------------------------------------------------------------- http_publish(Req) -> - Params0 = mochiweb_request:parse_post(Req), - Params = [{iolist_to_binary(Key), Val} || {Key, Val} <- Params0], + Params = [{iolist_to_binary(Key), Val} || {Key, Val} <- mochiweb_request:parse_post(Req)], lager:info("HTTP Publish: ~p", [Params]), Topics = topics(Params), ClientId = get_value(<<"client">>, Params, http), @@ -152,13 +151,15 @@ authorized(Req) -> user_passwd(BasicAuth) -> list_to_tuple(binary:split(base64:decode(BasicAuth), <<":">>)). -int(S) when is_integer(S)-> S; +int(I) when is_integer(I)-> I; int(S) -> list_to_integer(S). bool(0) -> false; bool(1) -> true; bool("0") -> false; -bool("1") -> true. +bool("1") -> true; +bool(<<"0">>) -> false; +bool(<<"1">>) -> true. is_websocket(Upgrade) -> Upgrade =/= undefined andalso string:to_lower(Upgrade) =:= "websocket".