Alexander Shorin created COUCHDB-1608:
-----------------------------------------
Summary: Update functions are broken if response code explicitly
defined.
Key: COUCHDB-1608
URL: https://issues.apache.org/jira/browse/COUCHDB-1608
Project: CouchDB
Issue Type: Bug
Components: HTTP Interface
Affects Versions: 1.3
Reporter: Alexander Shorin
Priority: Blocker
If update function accept document saving and has explicitly defined response
code CouchDB raises bad_match error and interrupt connection.
Example dummy update function:
function(doc, req){
return [{"_id": req["uuid"]}, {"code": 201, {"json": {"status": "ok"}}}]
}
Error in logs:
[Wed, 21 Nov 2012 12:09:55 GMT] [error] [<0.3301.0>] Uncaught error in HTTP
request: {error,
{badmatch,
[{<<"code">>,201},
{<<"json">>,
{[{<<"status">>,
<<"ok">>}]}}]}}
I suppose this behaviour was brought with X-Couch-ID header feature[1]. While
it's HTTPish to store documents with 201 response this not always works
especially with wrong designed "enterprise" http clients that doesn't respect
anything except code 200. Also, now it's not possible to save document and
redirect somewhere.
Debug logs enabled:
https://www.friendpaste.com/1ISP0NQFtl5zgZVajDQzjC
[1]:
https://github.com/apache/couchdb/commit/0a64f310b43b90176bb59040e7e866978c429c88
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira