You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/01 11:05:47 UTC

[11/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74

Throw 400 bad request not 500 for unrecognised _changes feed param


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/4816754e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/4816754e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/4816754e

Branch: refs/heads/windsor-merge
Commit: 4816754e2513d20c2a1042d6b24331c76f63cb35
Parents: 0ba63fd
Author: Michael Rhodes <mi...@gmail.com>
Authored: Wed May 8 15:52:31 2013 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 17:20:30 2014 +0100

----------------------------------------------------------------------
 src/chttpd_db.erl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/4816754e/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index cb13805..c81bf85 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -71,9 +71,11 @@ handle_changes_req(#httpd{method='GET'}=Req, Db) ->
             fabric:changes(Db, fun changes_callback/2, {"normal", {"Etag",Etag}, Req},
                 ChangesArgs)
         end);
-    Feed ->
-        % "longpoll" or "continuous" or "eventsource"
-        fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs)
+    Feed when Feed =:= "continuous"; Feed =:= "longpoll"; Feed =:= "eventsource"  ->
+        fabric:changes(Db, fun changes_callback/2, {Feed, Req}, ChangesArgs);
+    _ ->
+        Msg = <<"Supported `feed` types: normal, continuous, longpoll, eventsource">>,
+        throw({bad_request, Msg})
     end;
 handle_changes_req(#httpd{path_parts=[_,<<"_changes">>]}=Req, _Db) ->
     send_method_not_allowed(Req, "GET,HEAD").