chris-l / mock-couch

A node.js module designed to mock a CouchDB server, mostly for unit testing purposes.
http://chris-l.github.io/mock-couch/
67 stars 44 forks source link

Return 404 from an _all_docs request if the database was not found. #12

Closed alexjeffburke closed 9 years ago

alexjeffburke commented 9 years ago

Hey,

I stumbled on this after using mock-couchdb to replace calls to a real couchdb server - checking the behaviour with CURL it seems to return the 404 missing database error regardless of whether _all_docs was appended to the database or not. This commit ensures that 404 is always returned.

Thanks, Alex J Burke.

chris-l commented 9 years ago

Thanks, not only for the patch, but also for putting this under the light. I noticed that this is not only a problem here, but also for other requests. (like trying to get a view of a non-existent database) I will add such verification to other requests, but I gotta think the best way to do it (not sure if that just copy-pasting those lines on the other files is the most elegant way to solve it)

Anyway, thanks again!

chris-l commented 9 years ago

By the way, in this commit e67a59442d1d17edc473f8d7e87b528e62701ffa I have changed your code to make it check for the existence of the database on every request, not only on _all_docs.

Thanks!