summaryrefslogtreecommitdiff
path: root/src/catlfish_web.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2015-11-13 14:33:49 +0100
committerLinus Nordberg <linus@nordu.net>2015-11-13 14:46:50 +0100
commitce66c555c35e17c1ca0e0b4ff28056526183fceb (patch)
tree11a3999316dca8728afd990135313efaa7028958 /src/catlfish_web.erl
parent65cfc5397062db367ad537ccf4bf09cd7ddcf096 (diff)
Whitespace.
Diffstat (limited to 'src/catlfish_web.erl')
-rw-r--r--src/catlfish_web.erl33
1 files changed, 22 insertions, 11 deletions
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.