You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/09/16 22:52:45 UTC
[jira] [Commented] (COUCHDB-2815) POST to /{db}/_all_docs with
invalid keys should return a 400 error instead of 500
[ https://issues.apache.org/jira/browse/COUCHDB-2815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14791107#comment-14791107 ]
ASF GitHub Bot commented on COUCHDB-2815:
-----------------------------------------
GitHub user nickva opened a pull request:
https://github.com/apache/couchdb-chttpd/pull/73
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
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nickva/couchdb-chttpd 2815-alldocs-post-400
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-chttpd/pull/73.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #73
----
commit 31c15c70d1c1885ccf1cf6f03f18d0b079d664d9
Author: Nick Vatamaniuc <va...@gmail.com>
Date: 2015-09-16T20:48:20Z
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)