remotestorage / remotestorage.js

⬡ JavaScript client library for integrating remoteStorage in apps
https://remotestoragejs.readthedocs.io
MIT License
2.31k stars 141 forks source link

DELETE 409 not handled #39

Closed michielbdejong closed 12 years ago

michielbdejong commented 12 years ago

CouchDB can return a 409 on DELETE, we need to handle that and retry with the right _rev in there probably

nilclass commented 12 years ago

Actually the rev (not _rev) parameter is required all the time. Alternatively "_deleted": true (with a PUT) could be used, if the whole document is still available on the client. That way the code for "put" could be reused.

http://wiki.apache.org/couchdb/HTTP_Document_API#DELETE

michielbdejong commented 12 years ago

i hope this fixes it, needs testing still: https://github.com/unhosted/remoteStorage.js/commit/71f783ad7aa3530fd97b1f657907872369c49725#diff-1

nilclass commented 12 years ago

looks good, will test in the evening. Thinking about it, I think a HEAD request would be enough to get the latest revision (in case of PUT the changes are ignored anyway, in case of DELETE there's really no reason to transmit all data again). With a HEAD request, the revision is sent along as ETag header.

michielbdejong commented 12 years ago

good point!

On Wed, Mar 7, 2012 at 1:25 PM, niklas < reply@reply.github.com

wrote:

looks good, will test in the evening. Thinking about it, I think a HEAD request would be enough to get the latest revision (in case of PUT the changes are ignored anyway, in case of DELETE there's really no reason to transmit all data again). With a HEAD request, the revision is sent along as ETag header.


Reply to this email directly or view it on GitHub: https://github.com/unhosted/remoteStorage.js/issues/39#issuecomment-4367897

nilclass commented 12 years ago

couch.js is gone, so this issue doesn't apply at the moment.