diff options
Diffstat (limited to 'src/couchdb/couch_httpd_rewrite.erl')
-rw-r--r-- | src/couchdb/couch_httpd_rewrite.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl index 276e0601..36b90928 100644 --- a/src/couchdb/couch_httpd_rewrite.erl +++ b/src/couchdb/couch_httpd_rewrite.erl @@ -132,7 +132,7 @@ handle_rewrite_req(#httpd{ #doc{body={Props}} = DDoc, % get rules from ddoc - case ?getv(<<"rewrites">>, Props) of + case couch_util:get_value(<<"rewrites">>, Props) of undefined -> couch_httpd:send_error(Req, 404, <<"rewrite_error">>, <<"Invalid path.">>); @@ -215,7 +215,7 @@ try_bind_path([Dispatch|Rest], Method, PathParts, QueryList) -> % QueryArgs1 Bindings2 = lists:foldl(fun({K, V}, Acc) -> K1 = to_binding(K), - KV = case ?getv(K1, QueryArgs1) of + KV = case couch_util:get_value(K1, QueryArgs1) of undefined -> [{K1, V}]; _V1 -> [] end, @@ -288,7 +288,7 @@ replace_var(Key, Value, Bindings) -> get_var(VarName, Props, Default) -> VarName1 = to_binding(VarName), - ?getv(VarName1, Props, Default). + couch_util:get_value(VarName1, Props, Default). %% doc: build new patch from bindings. bindings are query args %% (+ dynamic query rewritten if needed) and bindings found in @@ -302,7 +302,7 @@ make_new_path([?MATCH_ALL|_Rest], _Bindings, Remaining, Acc) -> Acc1 = lists:reverse(Acc) ++ Remaining, Acc1; make_new_path([{bind, P}|Rest], Bindings, Remaining, Acc) -> - P2 = case ?getv({bind, P}, Bindings) of + P2 = case couch_util:get_value({bind, P}, Bindings) of undefined -> << "undefined">>; P1 -> P1 end, @@ -370,20 +370,20 @@ normalize_path1([Path|Rest], Acc) -> %% @doc transform json rule in erlang for pattern matching make_rule(Rule) -> - Method = case ?getv(<<"method">>, Rule) of + Method = case couch_util:get_value(<<"method">>, Rule) of undefined -> ?MATCH_ALL; M -> to_binding(M) end, - QueryArgs = case ?getv(<<"query">>, Rule) of + QueryArgs = case couch_util:get_value(<<"query">>, Rule) of undefined -> []; {Args} -> Args end, - FromParts = case ?getv(<<"from">>, Rule) of + FromParts = case couch_util:get_value(<<"from">>, Rule) of undefined -> [?MATCH_ALL]; From -> parse_path(From) end, - ToParts = case ?getv(<<"to">>, Rule) of + ToParts = case couch_util:get_value(<<"to">>, Rule) of undefined -> throw({error, invalid_rewrite_target}); To -> |