You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ei...@apache.org on 2017/10/30 17:54:28 UTC

[couchdb] branch master updated: Return error 410 on temporary view request

This is an automated email from the ASF dual-hosted git repository.

eiri pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 28fae4d  Return error 410 on temporary view request
28fae4d is described below

commit 28fae4d11633c5d0b015f12b4cc77a8b26032907
Author: Eric Avdey <ei...@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" <co...@couchdb.apache.org>'].