summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-08-04 10:36:35 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-08-04 10:36:35 +0000
commitaea47cc3831fd7b5a8c926557ad79cffbe9639ef (patch)
treebf2ec65b7f4630b75aa0a0b8c3957d2c868fd100 /share
parent495c20b9856b2abcbdc5a4620d6b4304dcafd70d (diff)
Allow POSTing of a JSON object to /_session/ for login.
Closes COUCHDB-842, patch by Jonathan D. Knezek. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@982200 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/script/test/cookie_auth.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/share/www/script/test/cookie_auth.js b/share/www/script/test/cookie_auth.js
index 68ec882d..e919ed02 100644
--- a/share/www/script/test/cookie_auth.js
+++ b/share/www/script/test/cookie_auth.js
@@ -104,6 +104,18 @@ couchTests.cookie_auth = function(debug) {
T(CouchDB.login('Jason Davies', password).ok);
T(CouchDB.session().userCtx.name == 'Jason Davies');
+ // JSON login works
+ xhr = CouchDB.request("POST", "/_session", {
+ headers: {"Content-Type": "application/json"},
+ body: JSON.stringify({
+ name: 'Jason Davies',
+ password: password
+ })
+ });
+
+ T(JSON.parse(xhr.responseText).ok);
+ T(CouchDB.session().userCtx.name == 'Jason Davies');
+
// update one's own credentials document
jasonUserDoc.foo=2;
T(usersDb.save(jasonUserDoc).ok);