LoveSeat icon indicating copy to clipboard operation
LoveSeat copied to clipboard

Enables bulk document save and user creation on a Cluster

Open nfbvieira opened this issue 7 years ago • 0 comments

While the /db/_bulk_docs API documentation refers that:

The return type from a bulk insertion will be 201 Created, with the content of the returned structure indicating specific success or otherwise messages on a per-document basis.

when working with a clustered environment the actual status code returned is 202 Accepted, which causes an exception to be thrown in CouchDatabase class when validating the response of the bulk docs insertion at SaveDocuments method:

if (resp.StatusCode != HttpStatusCode.Created) { throw new System.Exception("Response returned with a HTTP status code of " + resp.StatusCode + " - " + resp.StatusDescription); }

A similar validation is made at CouchClient class, when creating a user at CreateUser method.

The CouchDB documentation regarding this behavior is unclear, and the only mentions I've found to the return of this status code were at /db and /db/doc API documentation, stating that it is returned when the data was accepted but not yet stored to disk.

I´ve added the Accepted status code to both validations mentioned above.

nfbvieira avatar Oct 26 '18 15:10 nfbvieira