couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woh...@apache.org
Subject [couchdb] 15/19: Return error 410 on temporary view request
Date Wed, 01 Nov 2017 02:52:28 GMT
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch 2.1.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b5d98788510dabf22651df9f00b3af0d3abaee81
Author: Eric Avdey <eiri@eiri.ca>
AuthorDate: Mon Oct 30 14:07:57 2017 -0300

    Return error 410 on temporary view request
---
 src/chttpd/src/chttpd_view.erl       |  2 +-
 test/javascript/tests/view_errors.js | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index 52c96cd..0aaa849 100644
--- a/src/chttpd/src/chttpd_view.erl
+++ b/src/chttpd/src/chttpd_view.erl
@@ -82,7 +82,7 @@ handle_view_req(Req, _Db, _DDoc) ->
 
 handle_temp_view_req(Req, _Db) ->
     Msg = <<"Temporary views are not supported in CouchDB">>,
-    chttpd:send_error(Req, 403, forbidden, Msg).
+    chttpd:send_error(Req, 410, gone, Msg).
 
 
 
diff --git a/test/javascript/tests/view_errors.js b/test/javascript/tests/view_errors.js
index 0d9cd79..dd60292 100644
--- a/test/javascript/tests/view_errors.js
+++ b/test/javascript/tests/view_errors.js
@@ -185,6 +185,18 @@ couchTests.view_errors = function(debug) {
           T(e.error == "query_parse_error");
           T(e.reason.match(/no rows can match/i));
       }
+
+      // querying a temporary view should give "gone" error message
+      var xhr = CouchDB.request("POST", "/" + db_name + "/_temp_view", {
+        headers: {"Content-Type": "application/json"},
+        body: JSON.stringify({language: "javascript",
+          map : "function(doc){emit(doc.integer)}"
+        })
+      });
+      T(xhr.status == 410);
+      result = JSON.parse(xhr.responseText);
+      T(result.error == "gone");
+      T(result.reason == "Temporary views are not supported in CouchDB");
     // });
 
   // cleanup

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <commits@couchdb.apache.org>.

Mime
View raw message