Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
2.0.0
-
None
-
None
-
None
Description
When attempting to GET a database with an illegal name, CouchDB 1.6 returns a 400 bad request, but 2.0 gives a 404 not found error status.
CouchDB 1.6:
$ curl -iX GET localhost:5984/1abc HTTP/1.1 400 Bad Request Server: CouchDB/1.6.0 (Erlang OTP/18) Date: Tue, 21 Jun 2016 09:25:08 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 195 Cache-Control: must-revalidate {"error":"illegal_database_name","reason":"Name: '1abc'. Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."}
CouchDB 2.0:
$ curl -iX GET localhost:15984/1abc HTTP/1.1 404 Object Not Found Cache-Control: must-revalidate Content-Length: 58 Content-Type: application/json Date: Tue, 21 Jun 2016 09:25:12 GMT Server: CouchDB/be1dedb (Erlang OTP/18) X-Couch-Request-ID: 11fd8fb915 X-CouchDB-Body-Time: 0 {"error":"not_found","reason":"Database does not exist."}
While examining the issue, I noticed that the behaviour of GET /illegal-dbname is currently not specified in the API reference.
I would suggest to a) document this behaviour of CouchDB in the API reference of both versions and b) maintain consistency between 1.6 and 2.0, unless there are good reasons to change it.