couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [08/50] chttpd commit: updated refs/heads/master to 58020ab
Date Thu, 28 Aug 2014 11:59:31 GMT
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/master
Commit: 4816754e2513d20c2a1042d6b24331c76f63cb35
Parents: 0ba63fd
Author: Michael Rhodes <mike.rhodes@gmail.com>
Authored: Wed May 8 15:52:31 2013 +0100
Committer: Robert Newson <rnewson@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").


Mime
View raw message