diff options
Diffstat (limited to 'src/catlfish_web.erl')
-rw-r--r-- | src/catlfish_web.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/catlfish_web.erl b/src/catlfish_web.erl index ea34928..f44745d 100644 --- a/src/catlfish_web.erl +++ b/src/catlfish_web.erl @@ -27,7 +27,7 @@ split_path(Parts) -> {Fun, App}. loop(Req, Module) -> - "/" ++ Path = Req:get(path), % FIXME no need to strip "/" + Path = Req:get(path), {Fun, App} = split_path(string:tokens(Path, "/")), lager:debug("Fun=~s; App=~s;", [Fun, App]), try @@ -38,13 +38,13 @@ loop(Req, Module) -> Query = Req:parse_qs(), {_, RawQuery, _} = mochiweb_util:urlsplit_path(Req:get(raw_path)), Result = case http_auth:verify_auth(AuthHeader, "GET", - "/" ++ Path, RawQuery) of + Path, RawQuery) of failure -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> lager:debug("GET ~p ~p", [Path, Query]), - add_auth("/" ++ Path, + add_auth(Path, Module:request(get, App, Fun, Query)); noauth -> lager:debug("GET ~p ~p", [Path, Query]), @@ -62,13 +62,13 @@ loop(Req, Module) -> 'POST' -> Body = Req:recv_body(), Result = case http_auth:verify_auth(AuthHeader, "POST", - "/" ++ Path, Body) of + Path, Body) of failure -> {403, [{"Content-Type", "text/plain"}], "Invalid credentials"}; success -> lager:debug("POST ~p ~p", [Path, Body]), - add_auth("/" ++ Path, + add_auth(Path, Module:request(post, App, Fun, Body)); noauth -> lager:debug("POST ~p ~p", [Path, Body]), |