From ce66c555c35e17c1ca0e0b4ff28056526183fceb Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 13 Nov 2015 14:33:49 +0100 Subject: Whitespace. --- src/catlfish_web.erl | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/catlfish_web.erl') diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index d49aaa1..e541a9b 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -26,39 +26,49 @@ loop(Req, Module) -> 'GET' -> Query = Req:parse_qs(), {_, RawQuery, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)), - Result = case http_auth:verify_auth(AuthHeader, "GET", "/" ++ Path, RawQuery) of + Result = case http_auth:verify_auth(AuthHeader, "GET", + "/" ++ Path, RawQuery) of failure -> - {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; + {403, [{"Content-Type", "text/plain"}], + "Invalid credentials"}; success -> lager:debug("GET ~p ~p", [Path, Query]), - add_auth("/" ++ Path, Module:request(get, Path, Query)); + add_auth("/" ++ Path, + Module:request(get, Path, Query)); noauth -> lager:debug("GET ~p ~p", [Path, Query]), Module:request(get, Path, Query) end, - lager:debug("GET finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), + lager:debug("GET finished: ~p us", + [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> - Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); + Req:respond({404, [{"Content-Type", "text/plain"}], + "Page not found"}); _ -> Req:respond(Result) end; 'POST' -> Body = Req:recv_body(), - Result = case http_auth:verify_auth(AuthHeader, "POST", "/" ++ Path, Body) of + Result = case http_auth:verify_auth(AuthHeader, "POST", + "/" ++ Path, Body) of failure -> - {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; + {403, [{"Content-Type", "text/plain"}], + "Invalid credentials"}; success -> lager:debug("POST ~p ~p", [Path, Body]), - add_auth("/" ++ Path, Module:request(post, Path, Body)); + add_auth("/" ++ Path, + Module:request(post, Path, Body)); noauth -> lager:debug("POST ~p ~p", [Path, Body]), Module:request(post, Path, Body) end, - lager:debug("POST finished: ~p us", [timer:now_diff(os:timestamp(), Starttime)]), + lager:debug("POST finished: ~p us", + [timer:now_diff(os:timestamp(), Starttime)]), case Result of none -> - Req:respond({404, [{"Content-Type", "text/plain"}], "Page not found"}); + Req:respond({404, [{"Content-Type", "text/plain"}], + "Page not found"}); _ -> Req:respond(Result) end; @@ -68,7 +78,8 @@ loop(Req, Module) -> catch Type:What -> [CrashFunction | Stack] = erlang:get_stacktrace(), - lager:error("Crash in ~p for path ~p: ~p ~p~n~p~n~p~n", [Module, Path, Type, What, CrashFunction, Stack]), + lager:error("Crash in ~p for path ~p: ~p ~p~n~p~n~p~n", + [Module, Path, Type, What, CrashFunction, Stack]), Req:respond({500, [{"Content-Type", "text/plain"}], "Internal Server Error\n"}) end. -- cgit v1.1