Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Send friendly error when rewrite rules are a String, not a JSON Array
Browse files Browse the repository at this point in the history
Original patch by Jan Lehnardt, r1037196.

BugzID: 11789
  • Loading branch information
kocolosk committed Feb 8, 2011
1 parent 6a262a9 commit 19d6676
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/chttpd_rewrite.erl
Expand Up @@ -126,7 +126,10 @@ handle_rewrite_req(#httpd{
case couch_util:get_value(<<"rewrites">>, Props) of
undefined ->
couch_httpd:send_error(Req, 404, <<"rewrite_error">>,
<<"Invalid path.">>);
<<"Invalid path.">>);
Bin when is_binary(Bin) ->
couch_httpd:send_error(Req, 400, <<"rewrite_error">>,
<<"Rewrite rules are a String. They must be a JSON Array.">>);
Rules ->
% create dispatch list from rules
DispatchList = [make_rule(Rule) || {Rule} <- Rules],
Expand Down

0 comments on commit 19d6676

Please sign in to comment.