summaryrefslogtreecommitdiff
path: root/src/chttpd_external.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-09 14:42:57 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 11:18:44 -0400
commitcb6e67e0dffe925794a700e6e5149ededaa8bf7a (patch)
treed902221e75b26a9cea3e1331ceda6a10f79c1226 /src/chttpd_external.erl
parent4da7e07ff67f9a0e29cd09c7c91ed3606ac01bdf (diff)
cleanup of customer_name code
Diffstat (limited to 'src/chttpd_external.erl')
-rw-r--r--src/chttpd_external.erl10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/chttpd_external.erl b/src/chttpd_external.erl
index d096bff9..9566ec28 100644
--- a/src/chttpd_external.erl
+++ b/src/chttpd_external.erl
@@ -58,7 +58,7 @@ json_req_obj(#httpd{mochi_req=Req,
method=Verb,
path_parts=Path,
req_body=ReqBody
- }, Db) ->
+ } = HttpReq, Db) ->
Body = case ReqBody of
undefined -> Req:recv_body();
Else -> Else
@@ -71,12 +71,10 @@ json_req_obj(#httpd{mochi_req=Req,
end,
Headers = Req:get(headers),
Hlist = mochiweb_headers:to_list(Headers),
- Customer = cloudant_util:customer_name(
- Req:get_header_value("X-Cloudant-User"), Req:get_header_value("Host")),
- {ok, Info} = ?COUCH:get_db_info(Db, Customer),
+ {ok, Info} = fabric:get_db_info(Db),
% send correct path to customer - BugzID 6849
- CustomerBin = list_to_binary(Customer),
+ CustomerBin = list_to_binary(cloudant_util:customer_name(HttpReq)),
Len = byte_size(CustomerBin),
FixedPath = case Path of
[<<CustomerBin:Len/binary, "/", DbName/binary>> | Rest] ->
@@ -86,7 +84,7 @@ json_req_obj(#httpd{mochi_req=Req,
end,
% add headers...
- {[{<<"info">>, {Info}},
+ {[{<<"info">>, {cloudant_util:customer_db_info(HttpReq, Info)}},
{<<"verb">>, Verb},
{<<"path">>, FixedPath},
{<<"query">>, to_json_terms(Req:parse_qs())},