daleharvey/pouchdb — pull request #786 by toddbluhm (2013-06-02 02:46:20+00:00)
Title: 772 cors credentials

I have added support for CORS Credentials to the http adapter and ajax function. In the process of doing that, I ended up adding support for cookie authentication too. I also fixed a bug in pouch.js where a require() somehow got into the main part of the file preventing execution of everything after it for the tests. Tests are included in the test.http.js file. Usage is as follows (can be found in tests too):

* var pouch = new Pouch("http://some-couch.com/relax", {withCredentials:true, cookieAuth:{username:'relax',password:'on-the-couch'}}, function(err, ret, res){});
* Pouch.deleteCookieAuth("http://some-couch.com/relax", {withCredentials:true}, function(err, ret, res){});

Note: You don't have to turn off the cors-server or enable cors on couch (its all self-contained within each test).