[
https://issues.apache.org/jira/browse/COUCHDB-2815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14803274#comment-14803274
]
ASF subversion and git services commented on COUCHDB-2815:
----------------------------------------------------------
Commit 31c15c70d1c1885ccf1cf6f03f18d0b079d664d9 in couchdb-chttpd's branch
refs/heads/master from [~kzx]
[ https://git-wip-us.apache.org/repos/asf?p=couchdb-chttpd.git;h=31c15c7 ]
POST to /{db}/_all_docs with invalid keys should return 400
Now they return 500. Since there is nothing wrong on the 500,
400 is more appropriate.
For example, turns requests like these:
http -a adm:pass POST http://127.0.0.1:15984/db1/_all_docs keys:='["1",2]'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{
"error": "2",
"reason": "{illegal_docid,2}"
}
Into:
http -a adm:pass POST http://127.0.0.1:15984/db1/_all_docs keys:='["1",2]'
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": "illegal_docid",
"reason": 2
}
COUCHDB-2815
> POST to /{db}/_all_docs with invalid keys should return a 400 error instead
> of 500
> ----------------------------------------------------------------------------------
>
> Key: COUCHDB-2815
> URL: https://issues.apache.org/jira/browse/COUCHDB-2815
> Project: CouchDB
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: Database Core, HTTP Interface
> Reporter: Nick Vatamaniuc
>
> Related to
> http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs
> end point.
> Example:
> * db1 created with two documents ids : "1" and "2".
> {code}
> http -a adm:pass POST http://127.0.0.1:15984/db1/_all_docs keys:='["1",2]'
> HTTP/1.1 500 Internal Server Error
> Cache-Control: must-revalidate
> Content-Length: 43
> Content-Type: application/json
> Date: Wed, 16 Sep 2015 18:25:08 GMT
> Server: CouchDB/b8b9968 (Erlang OTP/17)
> X-Couch-Request-ID: 898d97fc1f
> X-CouchDB-Body-Time: 0
> {
> "error": "2",
> "reason": "{illegal_docid,2}"
> }
> {code}
> Expected 400 error instead as there is nothing wrong with on the server.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)