couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject chttpd commit: updated refs/heads/master to 262944f
Date Fri, 04 Nov 2016 12:18:05 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 64235ef3b -> 262944f02


HTTP code 500 instead of 400 for invalid key during document creation

The wrong status code is returned when creating or updating a document
with an invalid key.
Returns:
{u'reason': u'Bad special document member: _invalid_key', u'error':
u'doc_validation'}
HTTPError: 500 Server Error: Internal Server Error
Expected: 400 Bad Request error

COUCHDB-3222


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/262944f0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/262944f0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/262944f0

Branch: refs/heads/master
Commit: 262944f0244c86c5fdb794ebe538fb916ff5415c
Parents: 64235ef
Author: Mayya Sharipova <mayyas@ca.ibm.com>
Authored: Thu Nov 3 19:46:05 2016 -0400
Committer: Mayya Sharipova <mayyas@ca.ibm.com>
Committed: Thu Nov 3 19:46:05 2016 -0400

----------------------------------------------------------------------
 src/chttpd.erl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/262944f0/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 33e7876..1723ebc 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -885,6 +885,8 @@ error_info({_DocID,{illegal_docid,DocID}}) ->
 error_info({error, {database_name_too_long, DbName}}) ->
     {400, <<"database_name_too_long">>,
         <<"At least one path segment of `", DbName/binary, "` is too long.">>};
+error_info({doc_validation, Reason}) ->
+    {400, <<"doc_validation">>, Reason};
 error_info({missing_stub, Reason}) ->
     {412, <<"missing_stub">>, Reason};
 error_info(request_entity_too_large) ->


Mime
View raw message