You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Robert Newson (JIRA)" <ji...@apache.org> on 2012/11/21 13:47:58 UTC

[jira] [Assigned] (COUCHDB-1608) Update functions are broken if response code explicitly defined.

     [ https://issues.apache.org/jira/browse/COUCHDB-1608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson reassigned COUCHDB-1608:
--------------------------------------

    Assignee: Robert Newson
    
> 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
>         Environment: Apache CouchDB 1.3.0a-9322770-git
>            Reporter: Alexander Shorin
>            Assignee: Robert Newson
>            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